I'm using this snippet for blockUI (jQuery plugin) to display a 'blahblah' text for 15 seconds, then it automatically disappears and unlocks the page.
<script>
jQuery(document).ready(function() {
jQuery.blockUI({
message: 'Blah blahblah',
timeout: 15000
});
});
</script>
Is there a way to display this just on first page load and not on every page of the site..?
Thanks in advance! :)
You don't specify whether you want to run the blockUI:
homediv
) specific to that page and put the code in a load function for that: $('#homediv').load(function () { //put the logic above here });
Edit
If it is the first one, and you only want to show the message once a week to visitors to the site, then try the following:
jQuery(document).ready(function() {
if($.cookie('firstvisit') == null) {
jQuery.blockUI({
message: 'Blah blahblah',
timeout: 15000
});
$.cookie('firstvisit', '0', {expires:7, path:'/'});
}
});
Change the 7
to the number of days to pass before you want to show the message again.