(function ($) { $(function () { const observer = new IntersectionObserver((entries) => { entries.forEach((entry) => { if (entry.isIntersecting) { const el = entry.target; const $el = $(el); const index = $el.closest('section').find(".anime").index(el); el.style.transitionDelay = `${index * 0.1}s`; el.classList.add("anime-on"); observer.unobserve(el); } }); }, { threshold: 0.1, rootMargin: "0px 0px -50px 0px" }); $(".anime").each(function () { observer.observe(this); }); }); })(jQuery);