Make vertical jquery slide down menu stay open -
Make vertical jquery slide down menu stay open -
a noob question. reply simple, somehow, cannot figure out, , need move on in project.
i have vertical nav menu, , have slide downwards on hover. menu remain open, 1 time has slid down. have tried deleting lastly row of code, doe not pretty.
i have tried implement stu nicholls method , did not work. effect have.
my html menu :
<nav id="verticalmenu"> <ul> <li><a class="slide" href="#">kalendarium</a> <ul class="down"> <li><a href="#">konzerte</a></li> <li><a href="#">seminare</a></li> <li><a href="#">vortraege</a></li> </ul> </li> <li><a href="#">projekte</a> </ul> and jquery it:
<script type="text/javascript"> (function($){ //cache nav var nav = $("#verticalmenu"); //add hovers submenu parents nav.find("li").each(function() { if ($(this).find("ul").length > 0) { //show subnav on hover $(this).mouseenter(function() { $(this).find("ul").stop(true, true).slidedown(); }); //hide submenus on exit $(this).mouseleave(function() { $(this).find("ul").stop(true, true).slideup(); }); } }); })(jquery); thanks lot!
just hide them on document load. there no need of if check, jquery internally
(function($){ var nav = $("#verticalmenu"); //add hovers submenu parents nav.find("li").each(function() { var li_ul = $(this).find("ul"); li_ul.hide(); //show subnav on hover $(this).mouseenter(function() { li_ul.stop(true, true).slidedown(); }); }); })(jquery); fiddle : http://jsfiddle.net/redwb/3/
jquery menu slidedown
Comments
Post a Comment