Relative Content

Tag Archive for vue.jsoptimizationvuejs3swiper.jsintersection-observer

Managing IntersectionObserver with SwiperJS Autoplay

I’m trying to set up an IntersectionObserver on my feedback section, which has an autoplay feature. I use SwiperJS in Vue 3. First check if the section is visible and then start autoplay, otherwise, I stop it. However, the observer continues to work endlessly, which might take up resources. I tried adding observer.disconnect() in the if statement, but then it stops observing after scrolling to the section for the first time.