The Wayback Machine - https://web.archive.org/web/20220618223402/https://github.com/nolimits4web/swiper/issues/4052
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

'swiper-button-disabled' class is not applied after initial render #4052

Open
1 of 3 tasks
AndrewBogdanovTSS opened this issue Dec 16, 2020 · 5 comments
Open
1 of 3 tasks

Comments

@AndrewBogdanovTSS
Copy link

@AndrewBogdanovTSS AndrewBogdanovTSS commented Dec 16, 2020

This is a (multiple allowed):

What you did

Created a swiper with items inside of it. Issue can be reproduced on default settings as well as with slidesPerView: 'auto'. Option watchOverflow is set to true

Expected Behavior

'swiper-button-disabled' should apply to navigation buttons right after initial render of the swiper if the number of slides is smaller than container width

Actual Behavior

'swiper-button-disabled' is not applied after initial render

@vltansky
Copy link
Collaborator

@vltansky vltansky commented Jan 21, 2021

@AndrewBogdanovTSS maybe #3627 related?

@AndrewBogdanovTSS
Copy link
Author

@AndrewBogdanovTSS AndrewBogdanovTSS commented Jan 23, 2021

@vltansky yes, it may be related

@nolimits4web
Copy link
Owner

@nolimits4web nolimits4web commented Jan 25, 2021

Would be good to see some minimal isolated example, as I can't replicate it with Swiper-Vue or with Swiper-Core

@AndrewBogdanovTSS
Copy link
Author

@AndrewBogdanovTSS AndrewBogdanovTSS commented Jan 28, 2021

@nolimits4web the workaround that worked for me was to update navigation after a delay in nextTick like so:

mounted() {
    this.$nextTick(() => {
        setTimeout(() => this.slider.navigation.update(), 0)
    }
}

so it may be related to the fact that swiper items are passed as a slot content and the moment swiper is trying to calculate it's width items aren't yet fully rendered, but that's just a guess. I don't know if I would be able to provide something more isolated than https://codesandbox.io/s/nuxt-swiper-qlvlg?file=/components/Swiper.vue in the near days. Maybe a bit later when I'll be a bit more free

@adinvadim
Copy link

@adinvadim adinvadim commented Aug 4, 2021

I have the same problem with slidesPerView: 'auto' and watchOverflow: true. Workaround didnt help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment