tags:

views:

78

answers:

1

Hello,

I am trying to create a drop down list i have it working but not fully, using this code

$(document).ready(function(){
 $("#zone-bar li em").hover(function() {
var hidden = $(this).parents("li").children("ul").is(":hidden");

$("#zone-bar>ul>li>ul").hide()        
$("#zone-bar>ul>li>a").removeClass();

if (hidden) {
 $(this)
  .parents("li").children("ul").toggle()
  .parents("li").children("a").addClass("zoneCur");
 } 
  });

});

I am managed to make it work so on hover the drop down list will appear which is does but when you move to select one of the items from the drop down list the drop down list closes any help to fix this would be great thanks.

+2  A: 

When building the dropdown menus you have to make sure there are no gaps between the hover button and the sub-menu. If there's a gap it will cause it to disappear because you're mousing out of the top menu item before mousing into the sub menu. You could also add a slight delay so it doesn't go away immediately.

Shawn Steward
+1 for delay. A little cleverness with delays can make menus feel a lot more "natural" (the way a user expects them to "feel" based on experience with their desktop environment).
eyelidlessness
i have check for gaps but not found any?? really not sure what im doing wrong here.
Can you post a link to the site you're working on?
Shawn Steward
here is where i am making the website http://doctorwohd.serveftp.com/
it works if i use .click but if i do .hover then it will not stay open