jQuery Plugin For AdBlock Detection - Adi.js

File Size: 12.9 KB
Views Total: 5063
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin For AdBlock Detection - Adi.js

Adi.js is a jQuery plugin that detects if the users are using Adblock and displays an alert modal dialog when they visit your website.

How to use it:

1. Include jQuery JavaScrip library, advertisement.js and jquery.adi.js on your webpage.

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="advertisement.js"></script>
<script src="jquery.adi.js"></script>

2. Don't forget to include the jquery.adi.css in the head section of the webpage that will provide the basic CSS styles for the Adblock alert dialog.

<link href="jquery.adi.css" rel="stylesheet">

3. Enable the AdBlock Detection plugin on your webpage.

$.adi()

4. Default options and callback functions.

$.adi({

  // modal title
  title: 'Adblock detected!',

  // modal content
  content: 'We noticed that you may have an Ad Blocker turned on. Please be aware that our site is best experienced with Ad Blockers turned off.',

  // 'light' or 'dark'
  theme: 'light',

  // callbacks
  onOpen: function() {},
  onClose: function() {},
  active: function() {},
  inactive: function() {}
  
})

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