jQuery PopUp Modal

jQuery PopUp Modal

Hi,

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:
  1. .pop-outer{
  2.   background-color: rgba(0, 0, 0, 0.5);
  3.   position: fixed;
  4.   top:0;
  5.   left:0;
  6.   width:100%;
  7.   height:100%;
  8.   display:none;
  9.   z-index:100;
  10. }

  11. .pop-inner{
  12.   background-color:green;
  13.   width:400px;
  14.   height:680px; 
  15.   border:3px solid yellow;
  16.   border-radius:8px;
  17.   margin: 2% auto;
  18.   padding:5px;
  19.   margin-top:40px;
  20.   z-index:100;
  21. }


Here's the jQuery code that I currently have:
  1. $(document).ready(function() {
  2. // Exit intent
  3. function addEvent(obj, evt, fn) {
  4.     if (obj.addEventListener) {
  5.         obj.addEventListener(evt, fn, false);
  6.     }
  7.     else if (obj.attachEvent) {
  8.         obj.attachEvent("on" + evt, fn);
  9.     }
  10. }

  11. // Exit intent trigger
  12. addEvent(document, 'mouseout', function(evt) {

  13.     if (evt.toElement == null && evt.relatedTarget == null ) {
  14.         $('.pop-outer').fadeIn();
  15.     };

  16. });

  17. // Closing the Popup Box
  18. $('a.close').click(function(){
  19.     $('.pop-inner').fadeIn();
  20.    });
  21. });