I have this animated counter and it is working fine. But I want to know what is the type of this selector and what is its role in the code. https://jsfiddle.net/jdL2px4a/3/
$(window).scroll(function () {
var oTop = $(".counter").offset().top;
if ($(window).scrollTop() > oTop) {
$(".count").each(function () {
var $this = $(this);
var val = $(this).attr("data-count");
$({ counter: 0 }).animate({ counter: val }, {
duration: 1000,
easing: 'swing',
step: function () {
$this.text(Math.ceil(this.counter));
}
});
});
}
});