I have a piece of code here below that shows divs and stores it in a cookie and it hides them if the cookie exist. the problem is when i add my 3 seconds delay into one of the div id’s when the page re-loads the the id with the delay keeps showing up
<script type="text/javascript" >
//Search script to hide
$(document).ready(function(){
$('#popUpsearch').effect("pulsate", { times:2 }, 4000);
$('#popUpsearch').fadeOut(5000);
$('#popUpsearch').load('a', function() {
$.cookie('contentsearch','hid', { expires: 365});
});
if ( $.cookie('contentsearch') == 'hid'){
$('#popUpsearch').hide();
};
$('#popUpnav').delay(3000).effect("pulsate", { times:2 }, 4000)
$('#popUpnav').fadeOut(6000);
$('#popUpnav').load('a', function() {
$.cookie('contentnav','hide', { expires: 365});
});
if ( $.cookie('contentnav') == 'hide'){
$('#popUpnav').hide();
};
});
//$(function() {
// $.cookie('searchbox','sb3', { expires: 365});
// if ($.cookie('searchbox') == 'sb3'){
// $('#popUpsearch').hide();
// };
// });
</script>
Use your If block so your only performing one set of actions at a time.