[Help]: Autoplay continues to run, when slider is not visible #266
Replies: 3 comments 7 replies
-
Hi @openscript, About the in viewport suggestionI’m personally not sure about how to approach this. Because the Embla core library doesn’t provide any feature for determining if it’s in viewport or not. I based this decision on the fact that most devs that build websites use some sort of in view library not just for their carousels, but also images and all sorts of stuff. Of course, some devs also choose to build their own in view utility. So the bottom line here is that adding this logic to Embla or its plugins duplicates that kind of logic. And if you have 10 libraries in your project it adds upp pretty quickly. But with that said, I don’t really have any strong opinions about adding this functionality to the autoplay plugin or not. If you think it adds more value adding it compared to leaving it out, I’m open to adding this feature to the plugin. If we add this to the plugin we should make sure to update the plugin page so it’s clear to users that they need to polyfill About the tab not active suggestionYou’re actually wrong about this 🙂. The call to running the next play is wrapped in an Best |
Beta Was this translation helpful? Give feedback.
-
I'm still experiencing this bug. Even updated to version 8.3.0 and it's still happening. |
Beta Was this translation helpful? Give feedback.
-
It seems like that Embla with the Autoplay plugin keeps running in the background, when it's no in the viewport or the tab is not visible.
Peek.2022-01-11.14-53.mp4
In suggest two new options for
autoplay
:stopWhenNotInViewport: boolean
: Stops autoplay when slider is not in viewport and resumes when it is again.stopWhenPageNotActive: boolean
: Stops autoplay when the page where the slider is embedded is in the background and resumes when it is in the foreground again.Beta Was this translation helpful? Give feedback.
All reactions