Page 2 of 2

Re: (windows).mouseleave(function() {

Posted: Mon Aug 17, 2015 12:49 am
by Thrawn
You could probably reuse the function instead of defining it twice:

Code: Select all

function blockEvent(e) {e.stopImmediatePropagation();e.stopPropagation();}; window.addEventListener("mouseleave", blockEvent, false); window.addEventListener("mouseout", blockEvent, false);

Re: (windows).mouseleave(function() {

Posted: Mon Aug 17, 2015 1:58 am
by barbaz
Yes, re-using the same function when possible is much better practice (I read somewhere that it saves a LOT on memory use, can't remember where). I was just thinking "sample code that should works & at least gives the basic idea" and not "most optimized code to do the job". :roll:
Thank you for pointing that out.