http://jsfiddle.net/h8rxa3pj/2/
$("#open_link").hover(function() {
$("#menu").removeClass("hidden");
},function() {
if ($("#menu").is(":hover")) {
$("#menu").mouseleave(function() {
$("#menu").addClass("hidden");
});
}
else {
$("#menu").addClass("hidden");
};
});
我已经查看了有关此问题的其他问题,并尝试了几乎所有解决方案,除了我无法理解的解决方案。
How do I check if the mouse is over an element in jQuery?
我觉得 Arthur 的回答可能有帮助,但我对 jQuery/JS 很陌生,我不知道如何在这里应用它。感谢帮助
最佳答案
$("#open_link, #menu").hover(function() {
$("#menu").removeClass("hidden");
});
$("#open_link, #menu").mouseleave(function() {
$("#menu").addClass("hidden");
});
关于javascript - Firefox/IE jQuery 为 (":hover") 无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30848030/