Skip to content

Commit

Permalink
fix(svelte): auto update Virtual slides on slides prop change
Browse files Browse the repository at this point in the history
fixes #4564
  • Loading branch information
nolimits4web committed May 19, 2021
1 parent 4523c0f commit ddf11b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/svelte/params-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const paramsList = [
'parallax',
'_scrollbar',
'_thumbs',
'virtual',
'_virtual',
'zoom',
];
export { paramsList };
6 changes: 6 additions & 0 deletions src/svelte/update-swiper.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ function updateSwiper(swiper, passedParams, changedParams) {
) {
needNavigationInit = true;
}
if (changedParams.includes('virtual')) {
if (passedParams.virtual && passedParams.virtual.slides && swiper.virtual) {
swiper.virtual.slides = passedParams.virtual.slides;
swiper.virtual.update();
}
}

updateParams.forEach((key) => {
if (isObject(currentParams[key]) && isObject(passedParams[key])) {
Expand Down

0 comments on commit ddf11b8

Please sign in to comment.