当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - Jquery UI navbar, hover effect

问题描述:

I have been working in this for a while and I am struggling to find a solution.

I am using bootstrap along with jquery. I have created this code which displays a dropdown menu with id of #drop when hovering over a list item with the id of #slider. Right now this code displays the extra dropdown menu(#drop) fine with no lag or glitching. All I want it to do now is disappear again when the mouse leaves the now visible element(#drop).

I have tried a few different methods including mouseout() and mouseleave() but nothing seems to make the element dissapear. Here is the code:

$('#slider').hover

(function(){

$("#drop").stop(true,true).hide().removeClass('hide').slideDown('slow');

},

function(){

$("#drop").stop(true,true);

}

);

Any help with this would be great. Thanks.

网友答案:

Use toggle.

$("#slider").toggle(function (){

$("#hover").stop().show();

},function (){

$("#hover").stop().hide();

});
分享给朋友:
您可能感兴趣的文章:
随机阅读: