Personal I have a PROGRESS BAR that displays numbers from 0% up to 100%, I need when the scroll is greater than 900px, start counting the numbers for example from 0% to 70% in the time of 2 seconds .. I have a code here is working fine .. it does the count only if I move the scroll of the page again it remaps the count .. I need the animation to be done only once only after the user exceeds the 900px of scroll .. follows the code:
if(scrollTop > 900) {
$('#front-bar').animate({ width: "70%" }, 2000);
// Percent count
$({ counter: 0 }).animate({ counter: 70 }, {
duration: 2000,
step : function(){
$('#front-bar-count').text(Math.ceil(this.counter) + ' %');
}
});
}