<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <div> <span class="count">202</span> <span class="count">202</span> </div> <style> .count{ font-size:60px; font-weight:bold } </style> <script> $('.count').each(function () { $(this).prop('Counter',0).animate({ Counter: $(this).text() }, { duration: 3000, easing: 'swing', step: function (now) { $(this).text(Math.ceil(now)); } }); }); </script>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <div> <span class="count">202</span> <span class="count">202</span> </div> <style> .count{ font-size:60px; font-weight:bold } </style> <script> $('.count').each(function () { $(this).prop('Counter',0).animate({ Counter: $(this).text() }, { duration: 3000, easing: 'swing', step: function (now) { $(this).text(Math.ceil(now)); } }); }); </script>
×
Mã nhúng & chia sẻ
Hiệu ứng Animated Number Counter bằng jQuery