我需要这个计数器从滚动开始,而不是之前。是否可以?
function startCounter(){
$('.counter').each(function (index) {
$(this).prop('Counter',0).animate({
Counter: $(this).text()
}, {
duration: 2000,
easing: 'swing',
step: function (now) {
$(this).text(Math.round(now*10)/10);
}
});
});
}
startCounter();
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<span class="counter">92.2</span>
牧羊人nacy
相关分类