Skip to content
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

[Nuxt 3] Slides appear all at once without spacing on initial page load #437

Open
michaelprys opened this issue Aug 22, 2024 · 2 comments
Open

Comments

@michaelprys
Copy link

michaelprys commented Aug 22, 2024

I'm using a route transition and when I refresh the page, I can see how slides appear all at once without spacing, and after the page is fully loaded they fall into place and are displayed correctly. I suppose the slider may be initializing before all elements and styles are fully loaded and applied, leading to incorrect spacing and layout initially. I tried putting the logic in onMounted and using nextTick, but it freezes the carousel instead.

Reproduction of the issue:
https://stackblitz.com/edit/nuxt-starter-ubrvzh?file=app.vue

Steps to reproduce:

If you don't use a route transition, select throttling profile like 'Slow 4G' in the 'Network' section of the browser and reload the page to see the issue.

Same issue is posted on nuxt-keen-slider github page: modbender/nuxt-keen-slider#2

@BlaineCas
Copy link

BlaineCas commented Oct 29, 2024

It's because of the image, it's a link and not downloaded, the same or worse will happen with data taken from the backend. My fix was to put the carousel in a template and give it the data for the slides in the props. And v-if="someData" ... render carousel.

@oikalyptus
Copy link

We had the same problem. To fix this I added initial styling and removed it in keen-slider’s created hook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants