Guest User

Untitled

a guest
Dec 14th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. // Counter Up Plugin [very easy and simple plugin, just this code is insert in js file and add html]
  2. $('.counter').each(function() {
  3. var $this = $(this),
  4. countTo = $this.attr('data-count');
  5.  
  6. $({ countNum: $this.text()}).animate({
  7. countNum: countTo
  8. },
  9.  
  10. {
  11.  
  12. duration: 8000,
  13. easing:'linear',
  14. step: function() {
  15. $this.text(Math.floor(this.countNum));
  16. },
  17. complete: function() {
  18. $this.text(this.countNum);
  19. //alert('finished');
  20. }
  21.  
  22. });
  23.  
  24.  
  25. // use in html
  26. <h1 class="counter" data-count="110">0</h1>
Add Comment
Please, Sign In to add comment