0👍
✅
You can use lodash.debounce for that. It just will call after the time you have passed. It only will execute the function within the last call parameters, avoiding unnecessary calls. You can check an example here.
You only have to wrap your function with the debouce
function
debounce(
function (param1) { console.log('hello' + param1)},
500
)
0👍
So, there is “mouseleave” which only triggeres, when the user has left the element.
myElement.addEventListener("mouseleave", function( event ) {
And the event object delivers some information about its behavior. With event.relatedTarget
you get the element on which the mouse were before.
Dunno if this helps but you can try it
Source:stackexchange.com