how does this animation work?

Posted by icicleking on Stack Overflow See other posts from Stack Overflow or by icicleking
Published on 2014-06-03T15:21:17Z Indexed on 2014/06/03 15:25 UTC
Read the original article Hit count: 182

Filed under:
|
|
|

I'm working with cookies to run or not run a jQuery animation someone else built:

 $(function () {
     $('div.transitional').click(function () {
         $('div.intro').removeClass('hidden');
         $('div.final').off('click');
     });

     ShowDiv($("div.transitional.hidden")[0]);
 });

 function ShowDiv(target) {
     target = $(target);
     target.removeClass('hidden');

     target.delay(500).animate({
         opacity: 1.0
     }, 300, 'easeInExpo', function () {
         ShowDiv($("div.transitional.hidden")[0]);
     })
 }

I have the cookie part working, but I'm confused about the anonymous function and the "ShowDiv" function. What is each part doing?

Functionally, the animation makes visible a series of pictures, then the whole site. I want to skip the animation and just make the whole site visible(if cookies='visited'). I'd like to do this without rewriting the animation script.

here's a link. What happens now is if you have the cookie the animation doesn't run and everything is hidden.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery