我有一个超大的菜单,它使用鼠标悬停意图来延迟下拉,我也为菜单设置了一个lightbox效果,但是代码使用了mouseenter和mouseleave,问题是,虽然下拉有一个延迟,所以只要鼠标经过lightbox就会触发。有没有办法将下面的代码更改为使用hoverintent而不是mouseenter/mouseleave?
<script>
$(document).ready(function() {
if (document.documentElement.clientWidth > 801) {
$("#mega-menu").mouseenter(function() {
$("#mm-nav-overlay").toggle();
}).mouseleave(function () {
$("#mm-nav-overlay").hide();
});
}
});
</script> 非常感谢
发布于 2017-08-13 22:34:33
因此,我选择在最后将上面的代码替换为:
$(document).ready(function() {
if (document.documentElement.clientWidth > 801) {
$("#mega-menu").mouseenter(function() {
timer = setTimeout(function(){
$("#mm-nav-overlay").toggle();
},200/* <--- the delay */)
}).mouseleave(function () {
clearTimeout(timer);
$("#mm-nav-overlay").hide();
});
}
});https://stackoverflow.com/questions/45541913
复制相似问题