小提琴和代码不言自明。我有一个悬停菜单,当 div 打开并且我尝试将鼠标移到它时,它会关闭。
<html>
<head>
<script src="http://cherne.net/brian/resources/jquery.hoverIntent.minified.js"></script>
<script>
$(document).ready(function(){
$(".dropdown-toggle-products").hoverIntent(makeVisible,makeInvisible);
}); // close document.ready
function makeVisible() {
$(".dropdown-menu.all-products-dropdown").fadeIn(100);
}
function makeInvisible() {
$(".dropdown-menu.all-products-dropdown").fadeOut(100);
}
</script>
</head>
<body>
<a role="button" class="dropdown-toggle-products">Hover me <b class="caret header"></b></a>
<ul class="dropdown-menu all-products-dropdown">
<li><a href="#">Now try to hover me</a></li>
</ul>
</body>
</html>