I have a jQuery plugin, which appears the box with Facebook Like button in the nottom-right corner of my page, when someone scrolls the page – that’s code:
<script type="text/javascript">
var counter = 0;
$(window).ready(function(){
$(window).click(function () {
$('#likebox').animate({right: 10, bottom: 10});
$.cookie("value", counter , {path: "/", expires: 30});
counter++;
});
$('#likebox .close').click(function(){
alert($.cookie("value"));
$('#likebox').css('visibility', 'hidden');
});
});
It works perfectly when I’m on my page, scrolling it – the box appears, but my problem is that the box always appears to me and my users every time they’re going to another page etc. How can I limit it to 3 times (for example) for one unique IP daily?
You would probably have to use some server side code to do this, or you could use Javascript cookies that expire in 24 hrs
http://www.electrictoolbox.com/jquery-cookies/