try this:
var div_top = $('#counter').offset().top;
$(window).scroll(function(){
if($(window).scrollTop() > div_top){
$({countNum: $('#counter').text()}).animate({countNum: 63 }, {
duration: 3000,
easing:'linear',
step: function() {
$('#counter').text(Math.floor(this.countNum));
},
complete: function() {
$('#counter').text(this.countNum);
}
});
}
});
it checks how far the div is (in px) from the top and how far you scrolled. and this gets cheched every time you scroll