检测 Adblock 的轻量级 jQuery 插件-Adi.js
Adi.js
用于Adblock检测的轻量级jQuery 插件。
bower install adi.js
To install follow the steps (order is important):
- IncludejQuery
- Includeadvertisement.jsand make surejQuery.adblock = false;is inside the file
- Includejquery.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$.adblockisundefined. Adblock is active |
inactive() | Callback function triggered when$.adblockisfalse. Adblock is inactive |
onOpen() | Callback function triggered when modal is appended todocument.bodyanddisplayis set toblock |
onClose() | Callback function triggered when modal'sdisplayis set tonone |
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'; } });
$.adi({ onOpen: function(el) { /* make the modal bounce in by adding animate.css classes on modal */ el.find('.jquery-adi_content').addClass('animated bounceInDown') }, });
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!