1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| var scrolldelay;
jQuery.extend( jQuery.easing,
{
easeOutQuad: function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
}
});
$(document).ready(function(){
if(jQuery.easing.easeOutQuad != undefined) {
$(window).scroll(function(){
window.clearTimeout(scrolldelay);
scrolldelay = window.setTimeout(scrollclouds, 200);
});
}
});
function scrollclouds() {
$('#cloud1, #cloud2, #cloud3, #cloud4').stop();
$('#cloud1').animate({top:-($(window).scrollTop() * .4)}, 2550, 'easeOutQuad');
$('#cloud2').animate({top:-($(window).scrollTop() * .5)}, 2600, 'easeOutQuad');
$('#cloud3').animate({top:-($(window).scrollTop() * .35)}, 2400, 'easeOutQuad');
$('#cloud4').animate({top:-($(window).scrollTop() * .6)}, 2650, 'easeOutQuad');
} |
Partager