Client Side Based Event Trigger Plugin - countLite

File Size: 26.9 KB
Views Total: 439
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Client Side Based Event Trigger Plugin - countLite

countLite is a lightweight (4Kb, gzipped) jQuery plugin for client side based event trigger without server side code. It can be used for displaying messages, limiting ad views, registration / paywall events, etc.

How to use it:

1. Include jQuery library and countLite on your page

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="countLite.js"></script>

2. Javascript

<script type="text/javascript">
$(function(){
	$('#counter-message').countLite({
		views: 10,
		instance: 'ex2_',
		maxViews: function(data){
		$('#counter-message').html('<h4>You Already visted this page <code>'+data.count+'</code> time(s) in past <code>'+data.days+'</code> days.</h4>');
		},
		callBack: function(data){
		if( data.count == 1 ){
		$('#counter-message').html('<h4>Appears this is the first time you visted this page.</h4><p>Refresh the page to see another message.</p>');

		} else if( data.remaining == 1 ){
		$('#counter-message').html('<h4>Last One!</h4><p>Refresh the page one more time.</p>');

		} else {
		$('#counter-message').html('<h4>You Have visted this page <code>'+data.count+'</code> time(s) in past <code>'+data.days+'</code> days.</h4> <p>You can view it <code>'+data.remaining+'</code> more times.</p>');
		}
		}
	});
});
</script>

3. Markup

<div id="counter-message"></div>

More Examples:


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