👹 Adblock Identifier
JavaScript CSS
Latest commit 4629a07 Jan 18, 2016 @balajmarius Update README.md
Permalink
Failed to load latest commit information.
README.md Update README.md Jan 18, 2016
advertisement.js first commit Oct 15, 2015
icn_close.png first commit Oct 15, 2015
icn_danger.png first commit Oct 15, 2015
jquery.adi.css Update jquery.adi.css Oct 15, 2015
jquery.adi.js Updated default message Oct 16, 2015

README.md

Adi.js 👹

Lightweight jQuery plugin for Adblock detection

Thumb

bower install adi.js

See it in action

To install follow the steps (order is important):

  • Include jQuery
  • Include advertisement.js and make sure jQuery.adblock = false; is inside the file
  • Include jquery.adi.js
  • Call $.adi({ /* your options here */ })

Options

All parameters are optional.

Option Type Description
title string/html Modal's title
content string/html Modal's description
theme string Available: light, dark (default: light)

Methods

Method Description
active() Callback function triggered when $.adblock is undefined.
Adblock is active
inactive() Callback function triggered when $.adblock is false.
Adblock is inactive
onOpen() Callback function triggered when modal is appended to document.body and display is set to block
onClose() Callback function triggered when modal's display is set to none

Examples

Don't let user to see the content if adblock is active

$.adi({
  onClose: function(el) {
    /* refresh each time user close the modal */
    window.location.reload(true);
  }
});

Redirect

$.adi({
  onClose: function(el) {
    window.location = 'http://some-website.com';
  }
});

Add animation to modal

$.adi({
  onOpen: function(el) {
    /* make the modal bounce in by adding animate.css classes on modal */
    el.find('.jquery-adi_content').addClass('animated bounceInDown')
  },
});