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

Fix for lazy loading in free mode #4275

wants to merge 1 commit into from


Copy link

@bcmk bcmk commented Feb 27, 2021

If both lazy loading and free mode are enabled, lazy loading may not work in some circumstances.
Basically if you move to not loaded yet slides with a mouse and completely stop moving before releasing, slides are not loaded.

I recorded a video showing it:
At first I'm opening a tab with an example built using current master branch of Swiper.
Then I'm opening a tab with the version patched with this proposed change.

Here are examples:
The version from master branch:
Fixed version:

I haven't created test cases yet and I would be grateful if someone points me to the correct way to add them.

Corresponding issue: #4274

P.S. It fixes the behavior only for loadOnTransitionStart: true.
The issue for loadOnTransitionStart: false still exists.

Copy link

We just started to write cypress tests, thats why autoplay still not exists.
Just create swiper\cypress\integration\modules\autoplay.js file and write the tests there.
See swiper\cypress\integration\modules\core.js for examples and swiper\cypress\support\commands.js for commands.

If you want to help & contribute more you're welcome to include more tests, it would help a lot :)

Copy link

bcmk commented Feb 28, 2021

@vltansky Thanks for pointing me to the tests! However, I didn't get what autoplay has to do with free mode? I guess I should write my test cases in swiper\cypress\integration\modules\core.js.

Copy link

vltansky commented Mar 1, 2021

Hey, right, I meant swiper\cypress\integration\modules\lazy-load.js, as it's a module it should have a separate file.

But if it will help you - you can write the test in swiper\cypress\integration\modules\core.js, I'll organize it later :)

Copy link

Hi! Thanks for pointing out the issue and for the fix. But this fix introduces some unnecessary calculation and actions running transitions (when there is not). So in 82bcc5c I just introduced new internal event for this, and do the lazy load

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

Successfully merging this pull request may close these issues.

None yet

3 participants