var currentNumber = $('#fun-level').text();
var cc = 1;
$(window).scroll(function() {
$('#fun-level').each(function(){
var cPos = $(this).offset().top;
var topWindow = $(window).scrollTop();
if (cPos < topWindow + 1000) {
if (cc < 2) {
cc = cc + 3;
$({numberValue: currentNumber}).animate({numberValue: 40}, {
duration: 2000,
easing: 'linear',
step: function() {
$('#fun-level').text(Math.ceil(this.numberValue));
}
});
}
}
});
});