jquery - toggle on click but doesn't slide back down once clicked -
I got a jQuery toggle that works, but when I click it again, this slide does not Clicking on it is being clicked on I also tried to click on others
What am I doing wrong? I've done this once, but maybe I forgot something relatively simple
javascript:
$ (function () {$ ("li.subMenu"). (Function () {$ (". SubMenu-link") slideup ("normal"); $ (this) .next (). Slidedown ();}); $ (". Submenu-link"). ': First'). Hide ();});
HTML:
& lt; Li class = "submenu" & gt; & Lt; I class = "lock" & gt; & Lt; / I & gt; & Lt; Span class = "title" & gt; User account & lt; / Span & gt; & Lt; Span class = "toggle" & gt; + & Lt; / Span & gt; & Lt; Ul class = "subMenu-link" & gt; & Lt; Li & gt; A link & lt; / Li & gt; & Lt; Li & gt; A link & lt; / Li & gt; & Lt; Li & gt; A link & lt; / Li & gt; & Lt; Li & gt; A link & lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt;
this:
< Code> $ (this) .next ();
Select the next Lee submenu item, which you can say that is already "down" (visible). You probably want to leave the unordered list in the submenu item. You can access it through children:
$ (this) .next (). Children ('subMenu-link') SlideDown ();
If first click is clicked, then it will hide first, then another will show. If the other is clicked, he will hide the other and show the third. However, if you click on the third number, it will slide only a slide and nothing else, since there is no fourth element.
If you are trying to do one shows and hides others, then you should instead use siblings:
$ (" Li.subMenu "). Click (function () ($ (this). Child (". Submenu-link"). SlideDown ("normal"); $ (this) .Syling (.) Children ('submenu-link'). );});
Comments
Post a Comment