My website features a preloader on every page.
<div id="preloader" >
<div id="status"></div>
<div id="statustext">some text</div>
</div>
This preloader is activated using the following jQuery code:
//<![CDATA[
var sCookie = Cookies.get('cargado');
if (sCookie != null)
{
$('#preloader').hide();
}
else
{
$(window).on('load', function ()
{ // ensures that the entire site has loaded
$('#status').fadeOut(); // fades out loading animation
$('#preloader').delay(350).fadeOut('slow'); // fades out the white DIV covering the website
$('body').delay(350).css({ 'overflow': 'visible' });
Cookies.set('cargado', 'si');
})
}
//]]>
I want the preloader to only appear once per session. This means that if a user navigates through 10 pages on my website, they should only see it on the first page, regardless of whether they entered from the home page or an internal page. I tried implementing the solution shown above by setting up a cookie, but unfortunately, the preloader div does not hide as intended.
You can view a test page created for this issue here: