Hey All, I came up with a workaround to get the Exit Intent trigger to work on cell phones and tablets!
By default, the trigger does not work on cell phones and tablets. Here is the video, message me if you have any questions - happy to help!
Just in case, here is the script I’ve added to the Custom JS field on the Settings tab of my widget’s settings:
// Function to show the Elfsight widget using the provided API method
function showElfsightPopup() {
if (typeof widget !== 'undefined' && widget.show) {
widget.show();
}
}
// Variables to track scroll position
let lastScrollTop = window.pageYOffset || document.documentElement.scrollTop;
let scrollThreshold = window.innerHeight * 0.35; // 35% of the viewport height
// Detect upward scrolling
window.addEventListener("scroll", function() {
let currentScroll = window.pageYOffset || document.documentElement.scrollTop;
if (lastScrollTop - currentScroll > scrollThreshold) {
showElfsightPopup();
}
lastScrollTop = currentScroll <= 0 ? 0 : currentScroll;
}, false);
// Detect back button press on mobile
window.addEventListener("popstate", function() {
showElfsightPopup();
});
// Push a new state into the history to enable back button detection
history.pushState(null, null, window.location.href);
// Detect beforeunload event
window.addEventListener("beforeunload", function() {
showElfsightPopup();
});
// Detect pagehide event
window.addEventListener("pagehide", function() {
showElfsightPopup();
});
// Detect visibility change event
document.addEventListener('visibilitychange', function() {
if (document.visibilityState === 'hidden') {
showElfsightPopup();
}
});
that makes me incredibly happy! aside from the actual business people making the websites and ads etc… I dont know anyone who uses computers anymore LOL
You’re awesome. Do you know how to remove the functionality of the pop-up being triggered upon tapping a new page link in my footer or any links on my page that route to other pages on my site?
// Function to show the Elfsight widget using the provided API method
function showElfsightPopup() {
if (typeof widget !== ‘undefined’ && widget.show) {
widget.show();
}
}
// Variables to track scroll position
let lastScrollTop = window.pageYOffset || document.documentElement.scrollTop;
let scrollThreshold = window.innerHeight * 0.35; // 35% of the viewport height
I’m back. hahah @dillonandrew Do you know how to get the title of the pop-up to pull my font from my website? I have “use font from website” selected with no luck. I’m building my site on Framer so I don’t have an option to add a font url into the css either.
// Function to show the Elfsight widget using the provided API method
function showElfsightPopup() {
if (typeof widget !== 'undefined' && widget.show) {
widget.show();
}
}
// Variables to track scroll position
let lastScrollTop = window.pageYOffset || document.documentElement.scrollTop;
let scrollThreshold = window.innerHeight * 0.35; // 35% of the viewport height
// Detect upward scrolling
window.addEventListener("scroll", function() {
let currentScroll = window.pageYOffset || document.documentElement.scrollTop;
if (lastScrollTop - currentScroll > scrollThreshold) {
showElfsightPopup();
}
lastScrollTop = currentScroll <= 0 ? 0 : currentScroll;
}, false);
// Detect back button press on mobile
window.addEventListener("popstate", function() {
showElfsightPopup();
});
// Push a new state into the history to enable back button detection
history.pushState(null, null, window.location.href);
// Detect beforeunload event
window.addEventListener("beforeunload", function() {
showElfsightPopup();
});
// Detect pagehide event
window.addEventListener("pagehide", function() {
showElfsightPopup();
});
// Detect visibility change event
document.addEventListener('visibilitychange', function() {
if (document.visibilityState === 'hidden') {
showElfsightPopup();
}
});
Hi, I was exploring useful tips in the Elfsight Community, and clicked your video, but it shows now as unavailable. I understand it is quite a while after you posted your tip, but I would be interested to get to know this option.
Hope you have a fresh link or can restore it,
kind regards,
Ingrid
// Function to show the Elfsight widget using the provided API method
function showElfsightPopup() {
if (typeof widget !== 'undefined' && widget.show) {
widget.show();
}
}
// Variables to track scroll position
let lastScrollTop = window.pageYOffset || document.documentElement.scrollTop;
let scrollThreshold = window.innerHeight * 0.35; // 35% of the viewport height
// Detect upward scrolling
window.addEventListener("scroll", function() {
let currentScroll = window.pageYOffset || document.documentElement.scrollTop;
if (lastScrollTop - currentScroll > scrollThreshold) {
showElfsightPopup();
}
lastScrollTop = currentScroll <= 0 ? 0 : currentScroll;
}, false);
// Detect back button press on mobile
window.addEventListener("popstate", function() {
showElfsightPopup();
});
// Push a new state into the history to enable back button detection
history.pushState(null, null, window.location.href);
// Detect beforeunload event
window.addEventListener("beforeunload", function() {
showElfsightPopup();
});
// Detect pagehide event
window.addEventListener("pagehide", function() {
showElfsightPopup();
});
// Detect visibility change event
document.addEventListener('visibilitychange', function() {
if (document.visibilityState === 'hidden') {
showElfsightPopup();
}
});
O wow, that’s a lot of Javascript. But I will keep a link to it, in case I ever feel I need an exit-intent popup that is important enough to bring in this much script.
Thanks, Max!
You can see that when you click the “Get it Now!” button, on the price tables, the popup appears.
And also appears when you click the button 'SEE WEBSITE" which is redirecting you on another website, but it is not an exit intent from the visitors but the want to learn more.
And if I visit the page directly through Facebook, which is how my visitors are visiting my page through Facebook ads, then the popup does not apper when you click the back button.
But when you visit the site from a browser, then the popup does apper when you click the back button, so that is good.
Let me know if there is any solution on the above, I really need to use your service and make it work. It is very hard to make a popup appear on mobile. I have tried at least 7-8 of your competitor and only yours work except what I mention above.