2011-11-06 89 views

回答

3

你不应该使用mouseout。相反,提供两个功能hover

$('#category2').hover(function() { 
    $('#category2').show(); // This function will be called upon mouseover 
}, function(e) { 
    $('#category2').hide(); // This one will properly be called on mouseout 
}); 

小提琴:http://jsfiddle.net/hvF8P/20/

边注:里面的功能,而不是使用$('#category2'),你也可以使用$(this)

+0

的功能(e)是否意味着呢? – user892134

+0

如果您没有将鼠标悬停在其上,则子菜单不会消失。 –

+0

@TomHubbard这是OP的设计。 '#catdrop'是与'#category2'不同的元素。 –