Как сделать что бы данная функция при докрутке срабатывала только один раз?
$(window).scroll(function() {
var trigger = jQuery('.animated').offset().top -500;
if (jQuery(this).scrollTop() > trigger) {
$('.nm').each(function() {
$(this).prop('Counter', 0).animate({
Counter: $(this).text()
}, {
duration: 2000,
easing: 'swing',
step: function(now) {
$(this).text(Math.ceil(now));
return false;
},
});
});
} else {}
});