Show a div when closing the tab

Asked

Viewed 68 times

0

Guys, to be very direct, I will use as an example this site: https://www.gospelprime.com.br/ Whenever you move the mouse towards the close tab button (or simply click on it - whoever you want, you can test by opening any site link in a new tab and accessing it by the keyboard shortcut [Alt + tab number] and then position the cursor over the close button), that appears a div suggesting registration in the feedburner. I’ve seen this on other sites too, but in my research I found nothing related.

From now on, thank you!

  • 1

    There are several topics with the same principle. Here is one of them: - https://answall.com/questions/40982/display-algo-ao-tenta-close-meu-site

1 answer

1


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

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

See on Jsfiddle.

  • Thank you, @dvd! That’s it! =]

Browser other questions tagged

You are not signed in. Login or sign up in order to post.