Play jQuery based animation intro only one time
I have a simple animation based on jQuery fadeIn and fadeOut - it just shows some elements and hides others sequentially when a visitor loads main page of the site. So, I use this animation only on one page. I only want this to be shown one time per session so that when user clicks "Ho开发者_高级运维me", this wouldn't show up any more, just skipped. How can I implement this?
you can implement it with a cookie. check if the user has the cookie, if(yes) then don't run the animation, else, do show.
Take a look at Cookies and HTML5 Storage.
Html 5 storage can be used with the plugin JStorage
Example
$(document).ready(function(){
if($.JStorage.get('intro_played') == false)
{
//Play the sexyness.
}
});
Theres also a cookie plug-in that works in exactly the same way apart from he data is stored differently on user end.
精彩评论