Show a div when closing the [duplicate]

1

Well, I'm going to use this site as an example: link Every time you move the mouse towards the close the tab button (or just click on it - whoever you like, you can test by opening any site link in a new tab and access it by the keyboard shortcut [Alt + tab number] and then position the cursor over the close button ), which appears a div suggesting inscription in the feedburner. I have seen this on other sites too, but in my searches I did not find anything related.

Thanks in advance!

    
asked by anonymous 11.02.2018 / 01:30

1 answer

1

Use the onmouseleave event, which executes the code when the mouse exits the viewport :

$(document).on("mouseleave", function(){
   // faça algo
});

View in JSFiddle .

    
11.02.2018 / 01:46