Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detecting new div before leaving the other one
Message
From
21/03/2016 12:22:18
 
 
To
21/03/2016 10:15:53
General information
Forum:
Javascript
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01633406
Message ID:
01633427
Views:
35
>>The mouseout event is going to fire before any events on the new target. - maybe set a timer in the handler, set a flag on the mouseenter event of the next div then check this when the timer expires ?
>
>I need to avoid timers. I will go back to the initial approach, based on Thierry's suggestion, and will see what happens.

Not sure that would work - if you have code in the mouseout of the div that has been left it will still fire before the mouseover of the entered div.....

You could try (again assuming no intervening element):
    oDiv.onmouseout = function(e) {
                     
                      if (e.relatedTarget.id === 'other-div') {
                          document.getElementById('other-div').onmouseover();
                      }
                      //other code here
                  };
Maybe also set a flag in the mouseover event handler to prevent the system mouseover running the code again
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform