Jquery ul Submenu slidetoggle issue -


I am creating a store using oscommerce and using a single addon that has a menu Displays a noodle list. The UL list looks like this ...

& lt; Ul id = 'suckertree1' & gt; & Lt; Li & gt; & Lt; A href = 'index.php? Cpath = 21 '& gt; Summer and lieutenant; / A & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = 'index.php? Cpath = 21_23 '& gt; Bike & lt; / A & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = 'index.php? Cpath = 21_23_28 '& gt; E-bike & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = 'index.php? Cpath = 21_23_27 '& gt; Mountain Road & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = 'index.php? Cpath = 21_23_26 '& gt; Road Bike & amp; Nbsp; (1) & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = 'index.php? Cpath = 21_24 '& gt; Clothing & lt; / A & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = 'index.php? Cpath = 21_23_28 '& gt; Gloves & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = 'index.php? Cpath = 21_23_27 '& gt; Shoes & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = 'index.php? Cpath = 21_23_26 '& gt; Security & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = 'index.php? Cpath = 22 '& gt; Winter & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt;

I am using jquery to hide a portion of the menu. When you click on the bike - it displays that submenu. My problem is that submenu does not link to the links, they close the menu again.

Here's my (awesome) jQuery code

  $ (document) .ready (function () {$ ("ul # suckertree1 li ul li ul"). Hide (); $ ("ul # suckertree1 li ul li a" ). (Function (e) {e.preventDefault (); $ ("ul # cicatrere 1 li ul li ul") SlideToggle ();});});  

Due to limitations with this menu, I'm already unable to specify classes other than # suckertree1 in the menu or ID. How can I prevent default () from affecting submenu points? Also, if you click an item to toggle a submenu below,

thanks

James

Instead:

  $ (" ul # suckertree1 li ul li ul "). Slide Toggle ();  & lt; A & gt; , because it is very easy to get on using it.  

& lt; Ul & gt; Or, like this:

  $ (this). Sighing ('ul'). Slide Toggle ();  

So it looks like this:

  $ (function () {$ ("ul # suckertree1 li ul li ul") Hide () ; $ ("Ul # suckertree1 li ul li: is (ul)"). Click (function (e) {$ (this) .siblings ('ul') SlideToggle (); e.preventDefault ( );});});  

This also works by using the sub menu links, and what we are doing is to handle this handler only < <<> > Contains element

  • ;
  • ;
  • No sub menu), this code is not even for that anchor. Suggests not, and it continues to be like normal href .


  • Comments

    Popular posts from this blog

    Eclipse CDT variable colors in editor -

    AJAX doesn't send POST query -

    wpf - Custom Message Box Advice -