При использовании колесика мыши для прокрутки страницы вниз событие mouseleave не запускается в IE11, пока курсор не будет перемещен. Прекрасно работает в Google Chrome.
jsFiddle: http://jsfiddle.net/tonyleeper/5vwf65f7/
HTML
<div class="box">Move the mouse cursor inside this box and observe the mouseenter event fires (background goes green). Next, use the mouse wheel to scroll down without moving the mouse cursor position, observe the mouseleave event doesn't fire. Finally, move the mouse cursor even a little, say 1px, and observe that the mouseleave event then fires</div>
CSS
.box {
font-family: arial;
font-size: 16px;
width: 300px;
height: 200px;
background-color: #000077;
color: #ffffff;
}
JavaScript
var box = document.getElementsByClassName('box')[0];
box.addEventListener('mouseenter', function (e) {
document.body.setAttribute('style', 'background-color: #007700');
});
box.addEventListener('mouseleave', function (e) {
document.body.setAttribute('style', 'background-color: #ffffff');
});
Существуют ли какие-либо известные обходные пути для принудительного запуска события при прокрутке?
jQuery, похоже, имеет ту же проблему: https://api.jquery.com/mouseleave/