Fade in on mouse movement
How do I fade in div content on first mouse movement, like on google.com, using JavaScript? I don't want it to fade out again. galambalazs Code: ( See it in action ) // attach event handler document.body.onmousemove = function(){ fadeIn( this, 1000 ); // 1000ms -> 1s this.onmousemove = null; // remove to only fade in once! }; // sets the opacity of an element (x-browser) function setOpacity( obj, value ) { if ( obj ) { obj.style.opacity = value / 100; obj.style.filter = 'alpha(opacity=' + value + ')'; obj.style.zoom = 1; } } // makes an element to fade in function fadeIn( dom, interval, delay