Posted By

cerxx on 11/15/18



Versions (?)

How can I detect when the mouse leaves the window?

 / Published in: JavaScript


In order to detect mouseleave without taking in account the scroll bar and the autcomplete field or inspect

  1. document.addEventListener("mouseleave", function(event){
  2. if(event.clientY <= 0 || event.clientX <= 0 || (event.clientX >= window.innerWidth ||
  3. event.clientY >= window.innerHeight)){
  4. ifc.desertgage();
  5. }
  6. });

Report this snippet  


RSS Icon Subscribe to comments
Posted By: milessmith on November 20, 2018

Thanks for sharing.I found a lot of interesting information here. A really good post, very thankful and hopeful that you will write many more posts like this one.

You need to login to post a comment.