Difference between revisions of "Template:Queens Canada/Scripts"

m
m
Line 277: Line 277:
 
}
 
}
  
var a = 0;
 
$(window).scroll(function() {
 
  
  var oTop = $('#counter').offset().top - window.innerHeight;
 
  if (a == 0 && $(window).scrollTop() > oTop) {
 
    $('.counter-value').each(function() {
 
      var $this = $(this),
 
        countTo = $this.attr('data-count');
 
      $({
 
        countNum: $this.text()
 
      }).animate({
 
          countNum: countTo
 
        },
 
 
        {
 
 
          duration: 2000,
 
          easing: 'swing',
 
          step: function() {
 
            $this.text(Math.floor(this.countNum));
 
          },
 
          complete: function() {
 
            $this.text(this.countNum);
 
            //alert('finished');
 
          }
 
 
        });
 
    });
 
    a = 1;
 
  }
 
 
});
 
  
 
</script>
 
</script>
Line 314: Line 283:
 
</script>
 
</script>
 
</html>
 
</html>
 
<script src="jquery-3.5.1.min.js"></script>
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
 

Revision as of 17:52, 10 August 2020