I want to display a pop-up on home page, but only once. If someone goes to other pages and then comes back to home page, I don't want to display it again.
Here's the code:
<script type="text/javascript" language="javascript">
$(document).ready(function(){
$("#displaybox").hide();
message: $('#displaybox'),
css: {
top: ($(window).height() - 391) /2 + 'px',
left: ($(window).width() - 556) /2 + 'px',
width: '556px'
}
});
$('.displayboxclose').attr('title','Click to close').click($.unblockUI);
setTimeout($.unblockUI, 30500);
});
</script>
Can someone help with inserting the cookie code?
I'm using jQuery BlockUI Plugin and jquery-cookie Plugin
Something like this might be usefull for you;
jQuery(function($) {
if (!$.cookie('blockuicookie')) {
// blockUI scripts goes here.
$.cookie('blockuicookie', true, { "expires": 30, "path": "/" });
setTimeout($.unblockUI, 30500);
}
});