59
rated 0 times
[
62]
[
3]
/ answers: 1 / hits: 28881
/ 11 Years ago, fri, february 21, 2014, 12:00:00
I have a jQuery script that shows an animated counter on page, but the script starts on page load, and I need it to be loaded when the user scrolls down to a specific <div>
.
<script>
$({countNum: $('#counter').text()}).animate({countNum: 63 }, {
duration: 3000,
easing:'linear',
step: function() {
$('#counter').text(Math.floor(this.countNum));
},
complete: function() {
$('#counter').text(this.countNum);
}
});
</script>
This script need to be executed when I scroll to this specific <div>
on a page.
<div id=counter></div>
More From » jquery