Hover on load doesn't work

clairedog

New Member
Demo: http://jsbin.com/afixay/3/edit1) place cursor over red box2) don't move cursor, just hit ctrl+r (page should be reloaded)3) you'll get no alert.Well, you will get an alert once you unhover/hover it back. The problem is, when cursor is placed over red box on a page load, \[code\]hover\[/code\] event is not fired (also no \[code\]mouseenter\[/code\]).How do I fix this?I know, browser's work seems to be true, but I really need to know if an element is hovered, even on page load.\[code\]$(function() { function hovered(e){ e.type == 'mouseenter' ? alert('on') : alert('off'); } $('.box').hover(hovered);});\[/code\]
 
Back
Top