So I have this code, but it does NOT trigger the way that I would like it to. I'm new to learning jQuery (a month or two) so I'm still not 100% with understanding this code that I have.
The code is supposed to create an "exit popup" to help folks learn about my subscribers newsletter, but it doesn't open if you scroll down the page & then try to exit. It only fires off if you are at the top of the page & then try to move off to click on the exit tab.
I need the code to fire off even when the user has scrolled down the page, & preferably have it only fire off no more than 2 times in one session. I know that this would also require some kind of cookie install.
Anyhow, here is the current code that I'm working with:
Would appreciate the help with getting the code to popup regardless if the user is at the top of the page or bottom. Thanks in advance if you can offer any help.
I am developing a sales page for one of my clients & have a jQuery popup with CSS modal. The problem that I'm having with the code that I'm using is that in Google Chrome, when the user hovers off of the browser, even at the bottom or sides of the screen, the popup keeps coming back when it's only supposed to come back when hovering near the tab exit at the top of the page. I'm trying to get it to where the jQuery can detect when the user actually navigates toward the tabs "X" (exit). Would be nice if the popup only came 1 time as well instead of repeating.
Here's the CSS code that I'm using:
.pop-outer{
background-color: rgba(0, 0, 0, 0.5);
position: fixed;
top:0;
left:0;
width:100%;
height:100%;
display:none;
z-index:100;
}
.pop-inner{
background-color:green;
width:400px;
height:680px;
border:3px solid yellow;
border-radius:8px;
margin: 2% auto;
padding:5px;
margin-top:40px;
z-index:100;
}
Here's the jQuery code that I currently have:
$(document).ready(function() {
// Exit intent
function addEvent(obj, evt, fn) {
if (obj.addEventListener) {
obj.addEventListener(evt, fn, false);
}
else if (obj.attachEvent) {
obj.attachEvent("on" + evt, fn);
}
}
// Exit intent trigger
addEvent(document, 'mouseout', function(evt) {
if (evt.toElement == null && evt.relatedTarget == null ) {