p.perfetto993
p.perfetto993

Reputation: 27

How to display div only once for session

I want to show this loader on my wordpress site only once for a user session, for the moment it is shown every time the page is loaded:

if(location.href === "http://www.example.com/") {
    jQuery(window).load(function() {
        jQuery(".famous-loader-overlay").delay(1500).fadeOut(500);
    });
}
else {    
    jQuery(".famous-loader-overlay").delay(0).hide();
}
       

Can someone help me?

Upvotes: 1

Views: 423

Answers (1)

Elvis Technologies
Elvis Technologies

Reputation: 151

you only have to add another session variable and call it properly seting on it to true o false state.

you can acomplish this with local set to true storage as value on variable :

localStorage.setItem('loaderShowed', true);

Upvotes: 1

Related Questions