0

I read this topic What event to use instead of onmouseout to run when mouse is not over the element?

The proposed method has not approached me .

How to determine that the cursor is moved to a other element? I search alternative

Community
  • 1
  • 1
Michael Phelps
  • 3,451
  • 7
  • 36
  • 64

1 Answers1

1

Not sure what you are really looking for, but to check an event, that occures when entering / leaving an element you should use onmouseenter / leave -events

As an alternative you could check something similiar by writing your own snippet, something like that: (just an example approach)

$(document).mousemove(function(evt){
// lets say you look for something like #header
   var myTarget = "header";
   var currentTarget = $(evt.target);
   if(myTarget != currentTarget.attr('id') ) {
    console.log('not on header')
   } else {
    console.log('on header')  
   }
})

edit Maybe you can give an example, so we could help more quick?

best

xhallix
  • 2,919
  • 5
  • 37
  • 55