Answer the question
In order to leave comments, you need to log in
How to make it so that when you scroll and reach the bottom of the site, statistics numbers quickly begin to be calculated?
Good afternoon, I want to make an unobtrusive effect. A person enters the landing page, scrolls, and when it comes to the moment with statistics, the numbers start from zero to quickly count up to a certain amount
Answer the question
In order to leave comments, you need to log in
$(window).scroll(function() {
$('#site-promo').each(function(){
var imagePos = $(this).offset().top;
var topOfWindow = $(window).scrollTop();
if (imagePos < topOfWindow+300) {
$('.way-img').addClass("stretchRight vv");
}
});
});
$('.way-img').addClass("stretchRight vv");
Alternatively use jquery.animateNumber.
aishek.github.io/jquery-animateNumber
And use a condition to trigger it something like this:
if (($(document).scrollTop() + $(window).height()) > ($('.animate- number-block').offset().top + 100)) {
animate_number();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question