Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  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. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement