SHARE
TWEET

Untitled

a guest Aug 20th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function numberCountUp() {
  2.     $('.js-countup').each(function () {
  3.         var year = $(this).text();
  4.         $(this).text(year - 80);
  5.         var tempyear = year - 80;
  6.         var self = this;
  7.         var scrollStart = () => {
  8.             if (( $(self).offset().top - 700) < $(window).scrollTop()) {
  9.                 var interval = setInterval( () => {
  10.                     if (tempyear < year) {
  11.                         tempyear++;
  12.                         $(self).text(tempyear);
  13.                     } else {
  14.                         clearInterval(interval);
  15.                         return false;
  16.                     }
  17.                 }, 15)
  18.             } else {
  19.                 window.requestAnimationFrame(scrollStart)
  20.             }
  21.         }
  22.         window.requestAnimationFrame(scrollStart)
  23.     });
  24. })();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top