-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scrollbar funky behaviour until resize event #4180
Comments
Then it can be issue on your side. If something in Swiper starts workin after window resize, then in 99% there was something wrong with init process, e.g. it was initialized in initially hidden container, or size was changed after init, etc. |
Could be for sure. I just saw the other issue, and thought it might be worth it to submit this variant. I am using ScandiPWA, built on top of Magento 2, so there are indeed a bunch of cogs and wheels around the slider. If something was wrong with the init process, why does firing the call 500 ms after completing the init not (always) fix it? I'd say that 9 out of 10 times it still doesn't work. I've updated it now to firing the event after Is there a better event to hook this into than |
Try to enable |
I have an issue on React where initially I added one item to the swipper with a load image, once the request for the actual items finished, all of them were added, this broke the left and right navigation arrow and the dragging, solved it by just setTimeout(() => window.dispatchEvent(new Event('resize')), 500). |
I had the same issue. I can add that simply manually calling update() or scrollbar.updateSize(), in the onImagesReady callback fixes the issue. Which is odd, and this does seem to be a bug, since the documentation suggests this is the intended built-in behavior, As an aside - enabling mutation observers as suggested made no difference. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed due to inactivity. If this issue is still actual, please, create the new one. |
What You Did
Initialized React component. I can't get it replicated on StackBlitz. It is possibly related to #2218, and the fix there works sometimes. Manually changing the viewport size fixes it immediately. Manually firing
window.dispatchEvent(new Event('resize'));
will also fix it immediately. Used settings:Expected Behavior
A working slider and scrollbar.
Actual Behavior
Scrollbar will be very funky until a
Resize
event is fired:(This is Chrome, Firefox is identical behaviour; both in desktop and emulated mobile mode)
The text was updated successfully, but these errors were encountered: