JSFiddle - React, Tailwind, and code Playground
by adeneo
HTML
<div id="a"></div>
<div id="b"></div>
CSS
#a, #b {position: absolute; height: 400px; width: 400px;}
#a {background: red; top: 20px: left: 20px;}
#b {background: blue; top: 200px; left: 200px;}
JavaScript
var timer;
$("#a, #b").mouseleave(function() {
timer = setTimeout(doSomething, 10);
}).mouseenter(function() {
clearTimeout(timer);
});
function doSomething() {
alert('mouse left');
}