I'm working on implementing a fade-in effect for content when the mouse moves (similar to Google's homepage), but I'd like to avoid this behavior if the cursor is hovering over a specific div.
Here are the basics:
$("html").hover(function() {
$("#navigation, #content").fadeIn("slow");
});
The above code successfully fades in the content. However, I've been struggling to detect when the cursor is positioned over a particular element. Here's what I've tried:
$("html").one("mousemove", function() {
if (mouseover == false) {
$("#navigation, #content").fadeIn("slow");
}
});
var mouseover = false;
$('#hero').mouseenter(function(){
mouseover = true;
}).mouseleave(function() {
mouseover = false;
});
I'm wondering if there's a more efficient way to achieve this effect. Any suggestions?