-
-
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
Using Swiper in Nuxt3 causes flickering issues. #7693
Comments
[en] : Using client-only in Nuxt3 loses the ability for SSR rendering, which is not SEO-friendly. [zh-cn]: 在Nuxt3中 使用 client-only 会失去SEO的能力。 |
[en]: I tried loading swiper.min.css separately, but the flickering still occurs. Initially, I thought importing the CSS file via ESM might cause the CSS file to be dynamically inserted into the page through JavaScript, leading to the flickering. However, I found that even when loading the full CSS file separately, the flickering still persists. [zh-cn]: 我尝试单独加载 swiper.min.css 但是还是会闪烁,我一开始以为是 通过 ESM引入 css文件会导致css文件是通过js动态执行插入到页面,导致的闪烁, 发现单独加载完整的css文件,仍旧闪烁 |
The same issue is occurring in Remix as well. |
I think you are referring to the content shift that occurs. I solve this issue in the following ways: Use CSS to define the size of each slide, corresponding to the Swiper breakpoints. Or: Use CSS to make the images visible once the slider is initialized. |
I think this is a duplicate of: #7577 |
Example:
|
Absolutely did not think to try this. I needed a workaround with CSS Var to handle my page margin and handle spaceBetween, but got everything working! It would be awesome perhaps if I could also just disable or replace the Javascript resizing mechanism of swiper… it seems silly to use both when the CSS performs better anyway. Anyone know of a way to disable it? |
Check that this is really a bug
Reproduction link
https://codesandbox.io/p/devbox/nuxt3-swiper-flicker-bug-rxlzms
Bug description
All dependencies and packages are the latest versions. I hope to use Swiper in Nuxt3 with SSR capability, but currently, the images flicker at the moment of loading.
Expected Behavior
When first entering the page, the images flicker, likely because Swiper has not accounted for the remaining space allocated by the parent container.
Actual Behavior
Images do not flicker, and the Swiper container displays normally.
Swiper version
11.1.9
Platform/Target and Browser Versions
macOS,Chrome
Validations
Would you like to open a PR for this bug?
The text was updated successfully, but these errors were encountered: