document.addEventListener("DOMContentLoaded", function() { window.addEventListener("scroll", function() { var image = document.querySelector(".scroll-image"); var container = image.closest(".elementor-widget-image"); var containerPosition = container.getBoundingClientRect().top; var screenPosition = window.innerHeight; if (containerPosition < screenPosition) { image.classList.add("scroll-active"); } else { image.classList.remove("scroll-active"); } }); });