Sorry, very new to Jquery (and not that skilled at js to begin with). I think I follow what you are saying, but not having a good grasp of the jquery syntax, I'm not sure exactly how to properly execute. Here's what I came up with, but it's not working, so I know there's a problem somewhere, but am unable to fix:
$(document).ready(function(){ var menuOn = false; $("li.main-nav").children('div').hide(); $("li.main-nav").bind("mouseenter mouseleave", function(){ if($(li.main-nav).children:hidden() { $(this).children('div').toggle(); $(this).toggleClass('menu-on'); return false; $(li.main-nav).children:visible(); menuOn = true; }); else ($(li.main-nav).children.visible { $(li.main-nav).children:hidden(); menuOn = false; }); }); }); On Jan 10, 2:54 am, "jQuery Lover" <ilovejqu...@gmail.com> wrote: > @serpicolugnut: read my previous post!!! > > Read jQuery HowTo Resource - http://jquery-howto.blogspot.com > > > > On Fri, Jan 9, 2009 at 7:06 PM, serpicolugnut <theodorew...@gmail.com> wrote: > > > I've got a full width drop down menu setup, using jquery's toggle to > > show/hide the hidden divs when the user clicks on the one of the <li> > > elements or any of it's children. > > > The problem I'm having (and it's kind of hard to reproduce), is that if the > > user has their mouse over one of the <li> items while the page is loading, > > the toggle becomes confused, and believes that on is off and off is on. > > Basically giving you a flickering menu. > > > Here's my Jquery code: > > > $(document).ready(function(){ > > $("li.main-nav").bind("mouseenter mouseleave", function(){ > > $(this).children('div').toggle(); > > $(this).toggleClass('menu-on'); > > return false; > > }); > > }); > > > And the URL of the test case: > > >http://dl.getdropbox.com/u/21984/menu_test/menu_test.html > > > I had figured if I told Jquery to hide all of the divs before I introduce > > the toggle function that would solve the problem, and tried using a piece of > > code that looks like this: > > > $(document).ready(function(){ > > $("li.main-nav").children('div').hide(); > > }); > > > ...but that didn't help. > > > Does anyone have any ideas on how I could fix this? > > -- > > View this message in > > context:http://www.nabble.com/Need-help-with-a-Jquery-toggle-bug-in-my-menu%2... > > Sent from the jQuery General Discussion mailing list archive at Nabble.com.