[Help]: Carousel freezes when using transform with intersection observer from VueUse #966
-
SummaryI'm using the intersection observer from VueUse https://vueuse.org/core/useIntersectionObserver/ on the Carousel component. I want to add a Below is the reproduction of the issue. I use shadcn-vue carousel, which is built with Embla. To see the issue try swiping in different directions and you will see that the carousel stops working and sometimes slides disappear. Navigation buttons won't work as well if add them. However, if you remove Carousel.issue.with.transform.and.intersection.observer.mp4If applicable, which variants of Embla Carousel are relevant to this question?
Additional informationNo response CodeSandbox examplehttps://stackblitz.com/edit/nuxt-starter-z2yqq6?file=app.vue |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
@michaelprys thanks for your question. I don’t know what VueUse is doing under the hood but yes, it’s quite likely that it’s causing this. Here are two suggestions that could possibly solve your problem:
Let me know how if it helps. |
Beta Was this translation helpful? Give feedback.
-
Regarding transforms where you said they're still ok to use. When I applied
I created a Solution: Regarding my observations, I was simply describing what I experienced when applying the class to the wrapper. I understand that you had mentioned similar points earlier, but I wanted to describe what exactly happens if you do it so others can better understand the issue and find a solution. I appreciate your time and help, hope it helps someone as well. Thank you for the response. |
Beta Was this translation helpful? Give feedback.
@michaelprys I'm not sure you have realistic expectations. Embla makes minimal changes to the DOM. There are only two ways it affects the DOM:
transform: translate3d
to the container to create the scroll effect.transform: translate3d
on slides that need to shift position in order to create the loop effect.That's all and it's a lot less compared to most carousel libraries. As long as you don't apply styles that affects el…