I have a counter on my page that is using the following code:
$(window).scroll(function(){
if ($(window).scrollTop() > 1400) {
var max = 67;
incCounter();
$('#counter').fadeIn(800);
}
function incCounter() {
var currCount = parseInt($('#counter').html());
$('#counter').html(currCount+1);
if (currCount+1 != max) {
setTimeout(incCounter, 20);
}
}
}
It starts at 0 and then continues without stopping at the maximum value. How do I get it to do so?