I wanted to detect whether the mouse was over an element when the web page was loaded. It appears this is not possible with jQuery - mouseover, hover etc. require a mouse move; as does getting the current mouse position (to compare with element bounds).
I have not seen this specific question asked, but have seen people saying the various bits of this aren't possible...
My solution: add a new CSS value with the hover pseudoselector, then test for that. This seems to only work sometimes, however.
CSS:
#el:hover {background-color: transparent; }
jQuery:
if ($('#el').css('background-color') == 'transparent')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With