JQuery Animationszahlzähler von Null bis Wert
Posted: 03 Jun 2025, 11:44
Ich habe ein Skript erstellt, um eine Zahl von Null bis zu seinem Wert zu animieren. class = "snippet-code-js Lang-js hübschesPrint-override">
Code: Select all
$({ Counter: 0 }).animate({
Counter: $('.Single').text()
}, {
duration: 1000,
easing: 'swing',
step: function() {
$('.Single').text(Math.ceil(this.Counter));
}
});< /code>
150< /code>
< /div>
< /div>
< /p>
funktioniert nicht < /h2>
Ich möchte jetzt das Skript mehrmals für jede Matching -Klasse mit dem Erfolg von jedem Matching -Class ausführen. weit: < /p>
HTML < /strong> < /p>
200
55
< /code>
JQuery < /strong> < /p>
$('.Count').each(function () {
jQuery({ Counter: 0 }).animate({ Counter: $(this).text() }, {
duration: 1000,
easing: 'swing',
step: function () {
$(this).text(Math.ceil(this.Counter));
}
});
});