Adding an "Exit Intent" popup w/ Javascript

Hi all,

I’m curious to know if it’s possible to add some javascript code to my ghost blog, so that a subscribe form pops up when the visitor’s cursor leaves the browser window. (I’m sure you’ve all seen how this works on other websites.)

For context: I’m using the Casper theme, which has a hidden overlay that visitors would see when clicking a ‘Subscribe’ button in the menu bar (in an earlier version of the Casper theme). What I’d like to do is just add a bit of code that will reveal the #subscribe div when a visitor begins to exit.

I’ve tried using the javascript code published here and it seems to do the trick for revealing the form – the only problem is that all of the form elements get deactivated. It seems to turn the #subscribe form into a static image.

I’m not sure how to modify the script so that the form functions as normal…

Hi Matt,

I’m trying to figure out the same thing (with my minimal knowledge of JavaScript). It seems you need to add this to make the form elements clickable:

element.style.pointerEvents = "auto"

I still need to properly test that, though.