Comments (9)
Thanks, it must have been something with my home made isMobile
hook.
I have migrated to breakpoints and everything works smooth.
Thank you so much and congrats on the 8.0 release
from embla-carousel.
I cant view that sandbox (404)
@smc13 sorry about that. I had to make the sandbox public
. Try now!
from embla-carousel.
@smc13 seems like you're doing stuff in the wrong order. You have to change the CSS first, before calling reInit()
so correct calculations can be made for the changed axis. Here's a working CodeSandbox.
Best,
David
from embla-carousel.
@davidjerleke I cant view that sandbox (404) but that does make sense. I'll need to restructure my vue app logic to delay passing the updated options to the plugin since currently vue will do both in the same frame.
Thanks,
Sam
from embla-carousel.
I've found in Vue I can update the watchers in the plugin to add { flush: 'post' }
which causes the watchers to fire after any DOM updates in the parent component.
Not sure if it'll cause any timing issues though (eg: if slides and options are updated at the time time, possibly causing the watchers reInit
and emblas native slide watcher to trigger at the same time)
from embla-carousel.
@davidjerleke I'm trying to achieve the same thing in React. Shouldn't embla handle the reactivity by default?
const axis = isMobile ? "x" : "y";
const [emblaMainRef, emblaMainApi] = useEmblaCarousel({
axis,
});
My isMobile
hook returns the correct value asyncronously and useEmblaCarousel
doesn't update when the axis changes
from embla-carousel.
@ancashoria did you pay attention to this? Answer to your question: Yes options are reactive.
from embla-carousel.
I have and even tried to delay the reinit and when axis changes:
useEffect(() => {
setTimeout(() => {
emblaMainApi?.reInit({ axis });
emblaThumbsApi?.reInit({ axis });
}, 1000);
}, [axis]);
from embla-carousel.
@ancashoria yes, but how about your CSS? Did you change it to align the slides vertically when the axis is y
?
from embla-carousel.
Related Issues (20)
- [Bug]: canScrollNext method returns false even when there are items to scroll HOT 1
- [Bug]: AutoScroll position jumps when clicked and dragged HOT 7
- [Bug]: Input click block after dragging HOT 2
- [Feat]: Add TypeScript moduleResolution: bundler support HOT 11
- [Bug]: Autplay stops working after drag HOT 2
- [Bug]: Cannot find module 'embla-carousel/components/Options' or its corresponding type declarations. TypeScript, React with Vite HOT 2
- [Bug]: Flickering when adding icon or image in slides (8.0) HOT 3
- [Bug]: Direction rtl reverses y axis direction HOT 5
- [Bug]: Slide hanging if overdragged/scrolled HOT 11
- [Bug]: Angular autoplay error HOT 1
- [Bug]: Autoplay fast scroll when opened in a new tab HOT 7
- [Bug]: no specific name for plugin import, have to use "index" instead HOT 4
- [Bug]: Embla Carousel's animation becomes less smooth when the battery saving mode is enabled. HOT 1
- [Bug]: Render when slides are wider than view size HOT 5
- [Bug]: When using the wheel gesture to swipe the carousel, for the first slide and the last slide, there are excessive blank space. HOT 2
- [Bug]: Thumbnails example won't work in RTL HOT 2
- [Bug]: Height is getting set to 0 HOT 4
- [Bug]: Scroll broken after direction update HOT 15
- [Bug]: Jest testing bug return TypeError: undefined is not a function HOT 2
- [Bug]: Slide slightly shifted when slide content is changing HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from embla-carousel.