Ive created code to show a pop up for exit intent.
Ive reworked it a few times but it doesnt work.
Can someone suggest where I am going wrong?
Originally i only put this code into the pages i wanted it to run on and it didnt work. SO I also added it into the lightbox code.
import wixWindow from ‘wix-window’;
import wixSite from ‘wix-site’;
wixSite.prefetchPageResources({
lightboxes: [“Newsletter”]
});
$w.onReady(function () {
$w(“#page1”).onMouseOut((event) => {
if (event.clientY <= 30) {
wixWindow.openLightbox(“Newsletter”);
}
});
});
Hi, @ToThrive !!
It worked correctly when I tried it on my end. 
import wixWindowFrontend from "wix-window-frontend";
import wixSiteFrontend from "wix-site-frontend";
$w.onReady(function () {
wixSiteFrontend.prefetchPageResources({
lightboxes: ["MyLightBoxName"]
});
$w("#page1").onMouseOut((event) => {
if (event.clientY <= 30) {
wixWindowFrontend.openLightbox("MyLightBoxName");
}
});
});
I think the double quotation marks around #page1
and Newsletter
are not in half-width, which could be causing the error. It might have just been converted when pasted here. 
Hi there! Great! I also tried again with another code, and it worked!
Looks like the same as yours!
import wixSite from ‘wix-site’;
import { openLightbox } from ‘wix-window-frontend’;
// Prefetch the lightbox so it loads instantly when triggered
wixSite.prefetchPageResources({
lightboxes: [‘Lightbox Name’]
});
$w(‘#page1’).onMouseOut(() => {
openLightbox(‘Lightbox Name’);
});
1 Like
I’m glad to hear that! Personally, I hadn’t come across this kind of exit prevention idea before, so it was really educational for me
. Just one more thing—your code imports wixSite
, but as far as I know, that module is deprecated. It might be better to update it to wixSiteFrontend
, like in my code. 
AH yes, I did come across that…will update it …thanks!