Faced a problem so that when scrolling down on the page, elements appear, after they have already appeared, the dosihpor script works, with each scrolling it continues to add the class active how to stop it. js:
$(window).scroll(function() { $(".advantage-options").each(function() { var pos = $(this).offset().top; var winTop = $(window).scrollTop(); if (pos < winTop + 780) { var i = 0; var interval = setInterval(function() { var cont = document.getElementsByClassName("adv-item"); if (i < cont.length) { cont[i].className += " active"; i++; } else { clearInterval(interval); } }, 120); } }); });