我正在尝试创建一个超级菜单,我想在显示菜单的特定声音时显示它。一旦显示了mega菜单(div),我想用鼠标(指针)保留它,并在指针移出div后关闭它。
这是我的菜单:
这是我的菜单,当你看到巨型菜单时,当你浏览“项目”链接时它会被打开:
目前,当我查看“项目”链接时,我可以显示菜单,但是当我将鼠标移出Mega菜单时,我不知道如何关闭它(div)
这是显示菜单的代码:
jQuery(document).ready(function(){
jQuery("#menu-item-15").hover(
function(){
jQuery("#mega-menu-projects").show();
}
);
});
答案 0 :(得分:0)
您可以使用鼠标悬停
jQuery(document).ready(function(){
jQuery("#menu-item-15").mouseover(
function(){
jQuery("#mega-menu-projects").show();
}
);
jQuery("#menu-item-15").mouseout(
function(){
jQuery("#mega-menu-projects").hide();
}
);
});
答案 1 :(得分:0)
试试这个(未经测试)
jQuery(document).ready(function(){
jQuery( "#menu-item-15" ).mouseout(function() {
jQuery("#mega-menu-projects").hide();
})
.mouseover(function() {
jQuery("#mega-menu-projects").show();
});
});
希望它对你有帮助