Cookie-enabled Exit Intent Popup Plugin With jQuery - Stick to me

File Size: 8.51 KB
Views Total: 11651
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Cookie-enabled Exit Intent Popup Plugin With jQuery - Stick to me

Just another 'Exit Popup' plugin built with jQuery that displays a configurable, cookie-enabled popup window when the user is about to leave the current page. The plugin detects the mouse position (when it is moving up to the address bar) and then fires an event to trigger a modal popup.

How to use it:

1. Include the stylesheet stick-to-me.css to style the exit popup.

<link rel="stylesheet" href="stick-to-me.css">

2. Add your own content to the exit popup.

<div id="stickLayer" style="display:none;" class="stick_popup">
  <div class="stick_close" onclick="$.stick_close()">X</div>
  <div class="stick_content">
    <h1>Goodbye!</h1>
  </div>
</div>

3. Include jQuery library and the JavaScript file stick-to-me.js at the bottom of the webpage.

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="stick-to-me.js"></script>

4. Initialize the plugin to create a default exit popup when the cursor moves out of view.

$.stickToMe({
  layer: '#stickLayer'      
});

5. You are able to config the exit popup with the following options.

$.stickToMe({

  // Animation speed in ms
  fadespeed: 400,

  // Where detection of exit intent takes place
  trigger: ['top'],

  // min/max time
  maxtime: 0,
  mintime: 0,

  // Delay before showing popup when exit intent is detected
  delay: 0,

  // Interval between popups
  interval: 0,

  // Maximum times the popup will be triggered  
  maxamount : 0,

  // Set cookie to prevent opening again on the same browser
  cookie : false,

  // Define the cookie expiration in seconds
  cookieExpiration: 0,

  // Clickon background to close the popup
  bgclickclose : true,

  // Press ESC to close the popup
  escclose : true,

  // Chrome disable
  disableleftscroll : true,

  // Callback function
  onleave : function (e) {},
    
});

Changelog:

2021-03-18

  • Add a more professional X closer

This awesome jQuery plugin is developed by guiassemany. For more Advanced Usages, please check the demo page or visit the official website.