VaR animateblock = {
Isvisiable: function (El, wh, St, Delta ){
Delta = delta || 200;
// Console. Log ($ (EL). offset (). Top, wh, St, Delta)
Return $ (EL). offset (). Top <Wh + st-delta;
},
Animations :{
Band: function (Wh, St ){
VaR $ El = $ ("# band ");
If (animateblock. isvisiable ($ El, wh, St )){
// Background: Time: 0-500.o
// Text: Time: 500-733.o.p: 10px;
// Menu: Time: 633-900.o.p:-10px;
$ ("# Js-band-BG"). animate ({opacity: 1}, 500 );
$ ("# Js-band-text"). Delay (500). animate ({top: 330, opacity: 1}, 233 );
$ ("# Js-header"). Delay (633). animate ({top: 0, opacity: 1}, 267 );
Delete animateblock. animations. band;
}
},
Character: function (Wh, St ){
VaR $ El = $ ("# characters ");
If (animateblock. isvisiable ($ El, wh, St )){
$ El. Find (". char-icon1"). animate ({top: 50, opacity: 1}, 333 );
$ El. Find (". char-icon2"). Delay (200). animate ({top: 50, opacity: 1}, 533 );
$ El. Find (". char-icon3"). Delay (400). animate ({top: 50, opacity: 1}, 733 );
Delete animateblock. animations. character;
}
},
Intro1: function (Wh, St ){
VaR $ El = $ ("# intro1 ");
If (animateblock. isvisiable ($ El, wh, St )){
// Console. Log ("trigger intro1 animate ");
$ El. Find (". intro1-video"). animate ({
"Bottom": 0,
Opacity: 1
},500 );
$ El. Find (". intro1-text"). Delay (167). animate ({opacity: 1}, 500 );
$ El. Find (". intro1-star"). Delay (333). animate ({opacity: 1}, 333 );
Delete animateblock. animations. intro1;
}
},
Intro2: function (Wh, St ){
VaR $ El = $ ("# intro2 ");
If (animateblock. isvisiable ($ El, wh, St )){
// Console. Log ("trigger intro2 animate ");
$ El. Find (". intro2-computer1"). animate ({
"TOP":-30,
Opacity: 1
},500 );
$ El. Find (". intro2-computer2"). Delay (500). animate ({
Opacity: 1
},167 );
$ El. Find (". intro2-text"). Delay (167). animate ({opacity: 1}, 500 );
Delete animateblock. animations. intro2;
}
},
Intro3: function (Wh, St ){
VaR $ El = $ ("# intro3 ");
If (animateblock. isvisiable ($ El, wh, St )){
// Console. Log ("trigger intro3 animate ");
$ El. Find (". intro3-calendar"). animate ({
"TOP":-31,
Opacity: 1
},333 );
$ El. Find (". intro3-rockets"). Delay (233). animate ({
"TOP":-46,
Opacity: 1
},267 );
$ El. Find (". intro3-smoke"). Delay (333). animate ({
"TOP":-31,
Opacity: 1
},334 );
$ El. Find (". intro3-text"). Delay (167). animate ({opacity: 1}, 500 );
Delete animateblock. animations. intro3;
}
},
Intro4: function (Wh, St ){
VaR $ El = $ ("# intro4 ");
If (animateblock. isvisiable ($ El, wh, St )){
// Console. Log ("trigger intro4 animate ");
$ El. Find (". intro4-hand"). animate ({
"TOP":-30,
Opacity: 1
},500 );
$ El. Find (". intro4-icon"). Delay (333). animate ({
Opacity: 1
},333 );
$ El. Find (". intro4-text"). Delay (167). animate ({opacity: 1}, 500 );
Delete animateblock. animations. intro4;
}
}
}
}
$ (Window). On ("scroll", function (){
VaR animations,
Name,
Winheight = $ (window). Height (),
Scrolltop = $ (window). scrolltop ();
Animations = animateblock. animations;
For (name in animations ){
Animations [name] (winheight, scrolltop );
}
});
If ($ (window). Height () & gt; 500 ){
$ (Document). Trigger ("scroll ");
}
Scroll event binding