I got some script that hides the mouse after few seconds of no movement and the desired result is that whenever the mouse is being hidden it should remove all of the hover state elements on the page.
To do so, I've got two functions:
var body = $('body');
function hideMouse() {
body.addClass("hideMouse");
body.on('mousemove', function(){
if(window.hiding) return true;
window.hiding = true;
body.removeClass("hideMouse");
$('div.mouseHider').remove();
clearTimeout(window.hideMouse);
window.hideMouse = setTimeout(function(){
body.addClass("hideMouse");
$('<div class="mouseHider"></div>').css({
position: 'fixed',
top: 0,
left: 0,
height: '100%',
width: '100%',
zIndex: 99999
}).appendTo(body);
redraw(document.body);
setTimeout(function(){
window.hiding = false;
}, 100);
}, 4000);
});
}
function redraw(e) {
e.style.display = 'none';
e.offsetHeight;
e.style.display = 'block';
}
I also have few css rules:
body.hideMouse *, body.hideMouse{
cursor: none;
}
body.hideMouse *{
pointer-events: none;
}
As expected, it works just fine in Chrome, Firefox and Opera. However, in IE11, what happens is that the mouse is indeed becoming invisible as expected but hover elements still shown as hovered.
A fiddle to demonstrate: http://jsfiddle.net/wjbkgsbg/
In IE11, the mouse is being hidden but the div's opacity remains 0.6 instead of falling back to 1.
Any suggestions?