开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜