Jquery slideToggle not applied to children in menu? -
Sorry, but I'm a jquery / js noob
I have this html for toggle menu Is the structure.
& lt; Li class = "topnavtopitem" & gt; & Lt; A href = "#" & gt; Topitem & lt; / A & gt; & Lt; Ul class = "topnavitemtoggle" & gt; & Lt; Li class = "toponvsubitum" & gt; & Lt; A href = "#" & gt; Subtitle & lt; / A & gt; & Lt; / Li & gt; & Lt; Li class = "toponvsubitum" & gt; & Lt; A href = "#" & gt; Subtitle & lt; / A & gt; & Lt; / Li & gt; & Lt; Li class = "toponvsubitum" & gt; & Lt; A href = "#" & gt; Subtitle & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt;
My jquery is:
$ (document) .ready (function () {$ ("topnavtopitem"). Click (function () { $ (".topnavitemtoggle", this) .slideToggle ("normal", function () {});});
});
I can not just figure out how I when I have a subitem ...
Pls help start beeing preventing slideToggle - thanks in advance
P>
You can use jQuery to prevent events from bubbling to dome. Elements to prevent click from the crusher for .topnavsubitem .topnavitemtoggle
set on your .
$ ('topnavsubitem'). On ('click', function (e) {e.stopPropagation ();});
Comments
Post a Comment