Re : Animation d'un nombre avec JQuery
tu peux jeter un oeil à la nouvelle démo
ça a l'air de tourner
copie du code
tu peux jeter un oeil à la nouvelle démo
ça a l'air de tourner

copie du code
Code:
$(window).bind('scroll', function() {
var wintop = $(window).scrollTop();
var winheight = $(window).height();
$('.Count').each(function (i, counter) {
var $this = $(counter);
var eltop = $this.offset().top;
var elheight = $this.outerHeight(true);
if (eltop + elheight < wintop || eltop > wintop + winheight) { if (!$this.hasClass('running')) { $this.removeClass('started');
}
}
if ( (wintop + winheight) > eltop && !$this.hasClass('started')) {
$this.addClass('started').addClass('running');
jQuery({ Counter: 0 }).animate({ Counter: $this.text() }, {
duration: 1000,
easing: 'swing',
step: function (i) {
$this.text(Math.ceil(i));
},
complete : function() {
$this.removeClass('running');
},
});
}
});
});







Commentaire