Jump to content

Onmouseover Event Not Working Properly


Recommended Posts

if(trigger.getAttribute("onmouseover")) {
document.addEventListener("mouseover", function(event) {
if(event.target !== elem && event.target !== elem.parentNode) {
if(elem.style.opacity == 1)
}, false)

The code above is not working properly as it is supposed to. I have a trigger element which is event.currentTarget. When the user hovers over the trigger item the elem is display. What I am looking for is that when the user hover over anything else on the page except the trigger and the elem items the elem should fade out.


The code works fine when I use onmouseenter event; however, that is not supported in safari and some older versions of other browsers as well. Therefore, please help with this I have been stuck at this problem for days now and there is no good online resource for it as well. Thanks! in advance...



Edited by sameer.entrout
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...