@gem-sdk/swiper 0.0.14-staging.2 → 0.0.15-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core-bk/core.less +225 -0
- package/core-bk/core.scss +227 -0
- package/package.json +2 -2
- package/shared/swiper-core.min.mjs +1 -1
- package/shared/swiper-core.min.mjs.map +1 -1
- package/shared/swiper-core.mjs +155 -557
- package/swiper-bundle.css +2 -2
- package/swiper-bundle.js +159 -561
- package/swiper-bundle.min.css +2 -2
- package/swiper-bundle.min.js +3 -3
- package/swiper-bundle.min.js.map +1 -1
- package/swiper-bundle.min.mjs +2 -2
- package/swiper-bundle.mjs +2 -2
- package/swiper-effect-utils.min.mjs +2 -2
- package/swiper-effect-utils.mjs +2 -2
- package/swiper-element-bundle.js +161 -563
- package/swiper-element-bundle.min.js +3 -3
- package/swiper-element-bundle.min.js.map +1 -1
- package/swiper-element-bundle.min.mjs +2 -2
- package/swiper-element-bundle.mjs +2 -2
- package/swiper-element.js +159 -561
- package/swiper-element.min.js +3 -3
- package/swiper-element.min.js.map +1 -1
- package/swiper-element.min.mjs +2 -2
- package/swiper-element.mjs +2 -2
- package/swiper-react.mjs +2 -2
- package/swiper-vue.mjs +2 -2
- package/swiper.css +2 -2
- package/swiper.js +157 -559
- package/swiper.less +2 -2
- package/swiper.min.css +2 -2
- package/swiper.min.js +3 -3
- package/swiper.min.js.map +1 -1
- package/swiper.min.mjs +2 -2
- package/swiper.mjs +2 -2
- package/swiper.scss +2 -2
package/swiper-bundle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Swiper 0.0.
|
|
2
|
+
* Swiper 0.0.15-dev.1
|
|
3
3
|
* Gem SDK - Swiper, Customized of swiper
|
|
4
4
|
* https://swiperjs.com
|
|
5
5
|
*
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Released under the MIT License
|
|
9
9
|
*
|
|
10
|
-
* Released on: March
|
|
10
|
+
* Released on: March 20, 2026
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
var Swiper = (function () {
|
|
@@ -879,9 +879,6 @@ var Swiper = (function () {
|
|
|
879
879
|
|
|
880
880
|
function updateSlides() {
|
|
881
881
|
const swiper = this;
|
|
882
|
-
function getDirectionPropertyValue(node, label) {
|
|
883
|
-
return parseFloat(node.getPropertyValue(swiper.getDirectionLabel(label)) || 0);
|
|
884
|
-
}
|
|
885
882
|
const params = swiper.params;
|
|
886
883
|
const {
|
|
887
884
|
wrapperEl,
|
|
@@ -890,10 +887,8 @@ var Swiper = (function () {
|
|
|
890
887
|
rtlTranslate: rtl,
|
|
891
888
|
wrongRTL
|
|
892
889
|
} = swiper;
|
|
893
|
-
const isVirtual = swiper.virtual && params.virtual.enabled;
|
|
894
|
-
const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length;
|
|
895
890
|
const slides = elementChildren(slidesEl, `.${swiper.params.slideClass}, swiper-slide`);
|
|
896
|
-
const slidesLength =
|
|
891
|
+
const slidesLength = slides.length;
|
|
897
892
|
let snapGrid = [];
|
|
898
893
|
const slidesGrid = [];
|
|
899
894
|
const slidesSizesGrid = [];
|
|
@@ -911,15 +906,15 @@ var Swiper = (function () {
|
|
|
911
906
|
let slidePosition = -offsetBefore;
|
|
912
907
|
let prevSlideSize = 0;
|
|
913
908
|
let index = 0;
|
|
914
|
-
if (typeof swiperSize === 'undefined')
|
|
915
|
-
return;
|
|
916
|
-
}
|
|
909
|
+
if (typeof swiperSize === 'undefined') return;
|
|
917
910
|
if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
|
|
918
911
|
spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize;
|
|
919
912
|
} else if (typeof spaceBetween === 'string') {
|
|
920
913
|
spaceBetween = parseFloat(spaceBetween);
|
|
921
914
|
}
|
|
922
|
-
|
|
915
|
+
|
|
916
|
+
// core-lite: compute total slides size without optional modules
|
|
917
|
+
swiper.slidesTotalSize = -spaceBetween;
|
|
923
918
|
|
|
924
919
|
// reset margins
|
|
925
920
|
slides.forEach(slideEl => {
|
|
@@ -937,49 +932,34 @@ var Swiper = (function () {
|
|
|
937
932
|
setCSSProperty(wrapperEl, '--swiper-centered-offset-before', '');
|
|
938
933
|
setCSSProperty(wrapperEl, '--swiper-centered-offset-after', '');
|
|
939
934
|
}
|
|
940
|
-
const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid;
|
|
941
|
-
if (gridEnabled) {
|
|
942
|
-
swiper.grid.initSlides(slides);
|
|
943
|
-
} else if (swiper.grid) {
|
|
944
|
-
swiper.grid.unsetSlides();
|
|
945
|
-
}
|
|
946
935
|
|
|
947
936
|
// Calc slides
|
|
948
937
|
let slideSize;
|
|
949
|
-
const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key =>
|
|
950
|
-
return typeof params.breakpoints[key].slidesPerView !== 'undefined';
|
|
951
|
-
}).length > 0;
|
|
938
|
+
const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter(key => typeof params.breakpoints[key].slidesPerView !== 'undefined').length > 0;
|
|
952
939
|
for (let i = 0; i < slidesLength; i += 1) {
|
|
953
940
|
slideSize = 0;
|
|
954
941
|
let slide;
|
|
955
942
|
if (slides[i]) slide = slides[i];
|
|
956
|
-
if (gridEnabled) {
|
|
957
|
-
swiper.grid.updateSlide(i, slide, slides);
|
|
958
|
-
}
|
|
959
943
|
if (slides[i] && elementStyle(slide, 'display') === 'none') continue; // eslint-disable-line
|
|
960
944
|
|
|
961
945
|
if (params.slidesPerView === 'auto') {
|
|
962
|
-
if (shouldResetSlideSize) {
|
|
946
|
+
if (shouldResetSlideSize && slides[i]) {
|
|
963
947
|
slides[i].style[swiper.getDirectionLabel('width')] = ``;
|
|
964
948
|
}
|
|
965
949
|
const slideStyles = getComputedStyle(slide);
|
|
966
950
|
const currentTransform = slide.style.transform;
|
|
967
951
|
const currentWebKitTransform = slide.style.webkitTransform;
|
|
968
|
-
if (currentTransform)
|
|
969
|
-
|
|
970
|
-
}
|
|
971
|
-
if (currentWebKitTransform) {
|
|
972
|
-
slide.style.webkitTransform = 'none';
|
|
973
|
-
}
|
|
952
|
+
if (currentTransform) slide.style.transform = 'none';
|
|
953
|
+
if (currentWebKitTransform) slide.style.webkitTransform = 'none';
|
|
974
954
|
if (params.roundLengths) {
|
|
975
955
|
slideSize = swiper.isHorizontal() ? elementOuterSize(slide, 'width', true) : elementOuterSize(slide, 'height', true);
|
|
976
956
|
} else {
|
|
977
957
|
// eslint-disable-next-line
|
|
978
|
-
const width =
|
|
979
|
-
const paddingLeft =
|
|
980
|
-
const paddingRight =
|
|
981
|
-
const marginLeft =
|
|
982
|
-
const marginRight =
|
|
958
|
+
const width = parseFloat(slideStyles.getPropertyValue('width')) || slide.offsetWidth;
|
|
959
|
+
const paddingLeft = parseFloat(slideStyles.getPropertyValue('padding-left')) || 0;
|
|
960
|
+
const paddingRight = parseFloat(slideStyles.getPropertyValue('padding-right')) || 0;
|
|
961
|
+
const marginLeft = parseFloat(slideStyles.getPropertyValue('margin-left')) || 0;
|
|
962
|
+
const marginRight = parseFloat(slideStyles.getPropertyValue('margin-right')) || 0;
|
|
983
963
|
const boxSizing = slideStyles.getPropertyValue('box-sizing');
|
|
984
964
|
if (boxSizing && boxSizing === 'border-box') {
|
|
985
965
|
slideSize = width + marginLeft + marginRight;
|
|
@@ -991,12 +971,8 @@ var Swiper = (function () {
|
|
|
991
971
|
slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth);
|
|
992
972
|
}
|
|
993
973
|
}
|
|
994
|
-
if (currentTransform)
|
|
995
|
-
|
|
996
|
-
}
|
|
997
|
-
if (currentWebKitTransform) {
|
|
998
|
-
slide.style.webkitTransform = currentWebKitTransform;
|
|
999
|
-
}
|
|
974
|
+
if (currentTransform) slide.style.transform = currentTransform;
|
|
975
|
+
if (currentWebKitTransform) slide.style.webkitTransform = currentWebKitTransform;
|
|
1000
976
|
if (params.roundLengths) slideSize = Math.floor(slideSize);
|
|
1001
977
|
} else {
|
|
1002
978
|
slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView;
|
|
@@ -1005,13 +981,13 @@ var Swiper = (function () {
|
|
|
1005
981
|
slides[i].style[swiper.getDirectionLabel('width')] = `${slideSize}px`;
|
|
1006
982
|
}
|
|
1007
983
|
}
|
|
1008
|
-
if (slides[i])
|
|
1009
|
-
slides[i].swiperSlideSize = slideSize;
|
|
1010
|
-
}
|
|
984
|
+
if (slides[i]) slides[i].swiperSlideSize = slideSize;
|
|
1011
985
|
slidesSizesGrid.push(slideSize);
|
|
1012
986
|
if (params.centeredSlides) {
|
|
1013
987
|
slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
|
|
1014
|
-
if (prevSlideSize === 0 && i !== 0)
|
|
988
|
+
if (prevSlideSize === 0 && i !== 0) {
|
|
989
|
+
slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
|
|
990
|
+
}
|
|
1015
991
|
if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween;
|
|
1016
992
|
if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
|
|
1017
993
|
if (params.roundLengths) slidePosition = Math.floor(slidePosition);
|
|
@@ -1019,55 +995,37 @@ var Swiper = (function () {
|
|
|
1019
995
|
slidesGrid.push(slidePosition);
|
|
1020
996
|
} else {
|
|
1021
997
|
if (params.roundLengths) slidePosition = Math.floor(slidePosition);
|
|
1022
|
-
if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0)
|
|
998
|
+
if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) {
|
|
999
|
+
snapGrid.push(slidePosition);
|
|
1000
|
+
}
|
|
1023
1001
|
slidesGrid.push(slidePosition);
|
|
1024
1002
|
slidePosition = slidePosition + slideSize + spaceBetween;
|
|
1025
1003
|
}
|
|
1026
|
-
swiper.
|
|
1004
|
+
swiper.slidesTotalSize += slideSize + spaceBetween;
|
|
1027
1005
|
prevSlideSize = slideSize;
|
|
1028
1006
|
index += 1;
|
|
1029
1007
|
}
|
|
1030
|
-
swiper.
|
|
1031
|
-
if (rtl && wrongRTL &&
|
|
1032
|
-
wrapperEl.style.width = `${swiper.
|
|
1008
|
+
swiper.slidesTotalSize = Math.max(swiper.slidesTotalSize, swiperSize) + offsetAfter;
|
|
1009
|
+
if (rtl && wrongRTL && params.effect === 'slide') {
|
|
1010
|
+
wrapperEl.style.width = `${swiper.slidesTotalSize + spaceBetween}px`;
|
|
1033
1011
|
}
|
|
1034
1012
|
if (params.setWrapperSize) {
|
|
1035
|
-
wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.
|
|
1036
|
-
}
|
|
1037
|
-
if (gridEnabled) {
|
|
1038
|
-
swiper.grid.updateWrapperSize(slideSize, snapGrid);
|
|
1013
|
+
wrapperEl.style[swiper.getDirectionLabel('width')] = `${swiper.slidesTotalSize + spaceBetween}px`;
|
|
1039
1014
|
}
|
|
1040
1015
|
|
|
1041
|
-
// Remove last
|
|
1016
|
+
// Remove last snap points depending on width (non-centered)
|
|
1042
1017
|
if (!params.centeredSlides) {
|
|
1043
1018
|
const newSlidesGrid = [];
|
|
1044
1019
|
for (let i = 0; i < snapGrid.length; i += 1) {
|
|
1045
1020
|
let slidesGridItem = snapGrid[i];
|
|
1046
1021
|
if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);
|
|
1047
|
-
if (snapGrid[i] <= swiper.
|
|
1022
|
+
if (snapGrid[i] <= swiper.slidesTotalSize - swiperSize) {
|
|
1048
1023
|
newSlidesGrid.push(slidesGridItem);
|
|
1049
1024
|
}
|
|
1050
1025
|
}
|
|
1051
1026
|
snapGrid = newSlidesGrid;
|
|
1052
|
-
if (Math.floor(swiper.
|
|
1053
|
-
snapGrid.push(swiper.
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
if (isVirtual && params.loop) {
|
|
1057
|
-
const size = slidesSizesGrid[0] + spaceBetween;
|
|
1058
|
-
if (params.slidesPerGroup > 1) {
|
|
1059
|
-
const groups = Math.ceil((swiper.virtual.slidesBefore + swiper.virtual.slidesAfter) / params.slidesPerGroup);
|
|
1060
|
-
const groupSize = size * params.slidesPerGroup;
|
|
1061
|
-
for (let i = 0; i < groups; i += 1) {
|
|
1062
|
-
snapGrid.push(snapGrid[snapGrid.length - 1] + groupSize);
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
for (let i = 0; i < swiper.virtual.slidesBefore + swiper.virtual.slidesAfter; i += 1) {
|
|
1066
|
-
if (params.slidesPerGroup === 1) {
|
|
1067
|
-
snapGrid.push(snapGrid[snapGrid.length - 1] + size);
|
|
1068
|
-
}
|
|
1069
|
-
slidesGrid.push(slidesGrid[slidesGrid.length - 1] + size);
|
|
1070
|
-
swiper.virtualSize += size;
|
|
1027
|
+
if (Math.floor(swiper.slidesTotalSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) {
|
|
1028
|
+
snapGrid.push(swiper.slidesTotalSize - swiperSize);
|
|
1071
1029
|
}
|
|
1072
1030
|
}
|
|
1073
1031
|
if (snapGrid.length === 0) snapGrid = [0];
|
|
@@ -1075,9 +1033,7 @@ var Swiper = (function () {
|
|
|
1075
1033
|
const key = swiper.isHorizontal() && rtl ? 'marginLeft' : swiper.getDirectionLabel('marginRight');
|
|
1076
1034
|
slides.filter((_, slideIndex) => {
|
|
1077
1035
|
if (!params.cssMode || params.loop) return true;
|
|
1078
|
-
if (slideIndex === slides.length - 1)
|
|
1079
|
-
return false;
|
|
1080
|
-
}
|
|
1036
|
+
if (slideIndex === slides.length - 1) return false;
|
|
1081
1037
|
return true;
|
|
1082
1038
|
}).forEach(slideEl => {
|
|
1083
1039
|
slideEl.style[key] = `${spaceBetween}px`;
|
|
@@ -1127,7 +1083,9 @@ var Swiper = (function () {
|
|
|
1127
1083
|
swiper.snapGrid = swiper.snapGrid.map(v => v + addToSnapGrid);
|
|
1128
1084
|
swiper.slidesGrid = swiper.slidesGrid.map(v => v + addToSlidesGrid);
|
|
1129
1085
|
}
|
|
1130
|
-
|
|
1086
|
+
|
|
1087
|
+
// Emit changes
|
|
1088
|
+
if (slidesLength !== (previousSlidesGridLength ? slides.length : slides.length)) {
|
|
1131
1089
|
swiper.emit('slidesLengthChange');
|
|
1132
1090
|
}
|
|
1133
1091
|
if (snapGrid.length !== previousSnapGridLength) {
|
|
@@ -1141,7 +1099,7 @@ var Swiper = (function () {
|
|
|
1141
1099
|
swiper.updateSlidesOffset();
|
|
1142
1100
|
}
|
|
1143
1101
|
swiper.emit('slidesUpdated');
|
|
1144
|
-
if (!
|
|
1102
|
+
if (!params.cssMode && params.effect === 'slide') {
|
|
1145
1103
|
const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`;
|
|
1146
1104
|
const hasClassBackfaceClassAdded = swiper.el.classList.contains(backFaceHiddenClass);
|
|
1147
1105
|
if (slidesLength <= params.maxBackfaceHiddenSlides) {
|
|
@@ -1155,20 +1113,13 @@ var Swiper = (function () {
|
|
|
1155
1113
|
function updateAutoHeight(speed) {
|
|
1156
1114
|
const swiper = this;
|
|
1157
1115
|
const activeSlides = [];
|
|
1158
|
-
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
|
|
1159
|
-
let newHeight = 0;
|
|
1160
|
-
let i;
|
|
1161
1116
|
if (typeof speed === 'number') {
|
|
1162
1117
|
swiper.setTransition(speed);
|
|
1163
1118
|
} else if (speed === true) {
|
|
1164
1119
|
swiper.setTransition(swiper.params.speed);
|
|
1165
1120
|
}
|
|
1166
|
-
const getSlideByIndex = index =>
|
|
1167
|
-
|
|
1168
|
-
return swiper.slides[swiper.getSlideIndexByData(index)];
|
|
1169
|
-
}
|
|
1170
|
-
return swiper.slides[index];
|
|
1171
|
-
};
|
|
1121
|
+
const getSlideByIndex = index => swiper.slides[index];
|
|
1122
|
+
|
|
1172
1123
|
// Find slides currently in view
|
|
1173
1124
|
if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) {
|
|
1174
1125
|
if (swiper.params.centeredSlides) {
|
|
@@ -1176,9 +1127,9 @@ var Swiper = (function () {
|
|
|
1176
1127
|
activeSlides.push(slide);
|
|
1177
1128
|
});
|
|
1178
1129
|
} else {
|
|
1179
|
-
for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) {
|
|
1130
|
+
for (let i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) {
|
|
1180
1131
|
const index = swiper.activeIndex + i;
|
|
1181
|
-
if (index > swiper.slides.length
|
|
1132
|
+
if (index > swiper.slides.length) break;
|
|
1182
1133
|
activeSlides.push(getSlideByIndex(index));
|
|
1183
1134
|
}
|
|
1184
1135
|
}
|
|
@@ -1187,14 +1138,13 @@ var Swiper = (function () {
|
|
|
1187
1138
|
}
|
|
1188
1139
|
|
|
1189
1140
|
// Find new height from highest slide in view
|
|
1190
|
-
|
|
1141
|
+
let newHeight = 0;
|
|
1142
|
+
for (let i = 0; i < activeSlides.length; i += 1) {
|
|
1191
1143
|
if (typeof activeSlides[i] !== 'undefined') {
|
|
1192
1144
|
const height = activeSlides[i].offsetHeight;
|
|
1193
1145
|
newHeight = height > newHeight ? height : newHeight;
|
|
1194
1146
|
}
|
|
1195
1147
|
}
|
|
1196
|
-
|
|
1197
|
-
// Update Height
|
|
1198
1148
|
if (newHeight || newHeight === 0) swiper.wrapperEl.style.height = `${newHeight}px`;
|
|
1199
1149
|
}
|
|
1200
1150
|
|
|
@@ -1339,46 +1289,16 @@ var Swiper = (function () {
|
|
|
1339
1289
|
slidesEl,
|
|
1340
1290
|
activeIndex
|
|
1341
1291
|
} = swiper;
|
|
1342
|
-
const
|
|
1343
|
-
const
|
|
1344
|
-
const
|
|
1345
|
-
return elementChildren(slidesEl, `.${params.slideClass}${selector}, swiper-slide${selector}`)[0];
|
|
1346
|
-
};
|
|
1347
|
-
let activeSlide;
|
|
1348
|
-
let prevSlide;
|
|
1292
|
+
const getNextSlide = slideEl => elementNextAll(slideEl, `.${params.slideClass}, swiper-slide`)[0];
|
|
1293
|
+
const getPrevSlide = slideEl => elementPrevAll(slideEl, `.${params.slideClass}, swiper-slide`)[0];
|
|
1294
|
+
const activeSlide = slides[activeIndex];
|
|
1349
1295
|
let nextSlide;
|
|
1350
|
-
|
|
1351
|
-
if (params.loop) {
|
|
1352
|
-
let slideIndex = activeIndex - swiper.virtual.slidesBefore;
|
|
1353
|
-
if (slideIndex < 0) slideIndex = swiper.virtual.slides.length + slideIndex;
|
|
1354
|
-
if (slideIndex >= swiper.virtual.slides.length) slideIndex -= swiper.virtual.slides.length;
|
|
1355
|
-
activeSlide = getFilteredSlide(`[data-swiper-slide-index="${slideIndex}"]`);
|
|
1356
|
-
} else {
|
|
1357
|
-
activeSlide = getFilteredSlide(`[data-swiper-slide-index="${activeIndex}"]`);
|
|
1358
|
-
}
|
|
1359
|
-
} else {
|
|
1360
|
-
if (gridEnabled) {
|
|
1361
|
-
activeSlide = slides.find(slideEl => slideEl.column === activeIndex);
|
|
1362
|
-
nextSlide = slides.find(slideEl => slideEl.column === activeIndex + 1);
|
|
1363
|
-
prevSlide = slides.find(slideEl => slideEl.column === activeIndex - 1);
|
|
1364
|
-
} else {
|
|
1365
|
-
activeSlide = slides[activeIndex];
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1296
|
+
let prevSlide;
|
|
1368
1297
|
if (activeSlide) {
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
nextSlide = slides[0];
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
|
-
// Prev Slide
|
|
1377
|
-
prevSlide = elementPrevAll(activeSlide, `.${params.slideClass}, swiper-slide`)[0];
|
|
1378
|
-
if (params.loop && !prevSlide === 0) {
|
|
1379
|
-
prevSlide = slides[slides.length - 1];
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1298
|
+
nextSlide = getNextSlide(activeSlide);
|
|
1299
|
+
prevSlide = getPrevSlide(activeSlide);
|
|
1300
|
+
if (params.loop && !nextSlide) nextSlide = slides[0];
|
|
1301
|
+
if (params.loop && !prevSlide) prevSlide = slides[slides.length - 1];
|
|
1382
1302
|
}
|
|
1383
1303
|
slides.forEach(slideEl => {
|
|
1384
1304
|
toggleSlideClasses(slideEl, slideEl === activeSlide, params.slideActiveClass);
|
|
@@ -1469,7 +1389,6 @@ var Swiper = (function () {
|
|
|
1469
1389
|
activeIndex = i;
|
|
1470
1390
|
}
|
|
1471
1391
|
}
|
|
1472
|
-
// Normalize slideIndex
|
|
1473
1392
|
if (params.normalizeSlideIndex) {
|
|
1474
1393
|
if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0;
|
|
1475
1394
|
}
|
|
@@ -1487,16 +1406,6 @@ var Swiper = (function () {
|
|
|
1487
1406
|
} = swiper;
|
|
1488
1407
|
let activeIndex = newActiveIndex;
|
|
1489
1408
|
let snapIndex;
|
|
1490
|
-
const getVirtualRealIndex = aIndex => {
|
|
1491
|
-
let realIndex = aIndex - swiper.virtual.slidesBefore;
|
|
1492
|
-
if (realIndex < 0) {
|
|
1493
|
-
realIndex = swiper.virtual.slides.length + realIndex;
|
|
1494
|
-
}
|
|
1495
|
-
if (realIndex >= swiper.virtual.slides.length) {
|
|
1496
|
-
realIndex -= swiper.virtual.slides.length;
|
|
1497
|
-
}
|
|
1498
|
-
return realIndex;
|
|
1499
|
-
};
|
|
1500
1409
|
if (typeof activeIndex === 'undefined') {
|
|
1501
1410
|
activeIndex = getActiveIndexByTranslate(swiper);
|
|
1502
1411
|
}
|
|
@@ -1514,32 +1423,12 @@ var Swiper = (function () {
|
|
|
1514
1423
|
}
|
|
1515
1424
|
return;
|
|
1516
1425
|
}
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
return;
|
|
1520
|
-
}
|
|
1521
|
-
const gridEnabled = swiper.grid && params.grid && params.grid.rows > 1;
|
|
1522
|
-
|
|
1523
|
-
// Get real index
|
|
1524
|
-
let realIndex;
|
|
1525
|
-
if (swiper.virtual && params.virtual.enabled && params.loop) {
|
|
1526
|
-
realIndex = getVirtualRealIndex(activeIndex);
|
|
1527
|
-
} else if (gridEnabled) {
|
|
1528
|
-
const firstSlideInColumn = swiper.slides.find(slideEl => slideEl.column === activeIndex);
|
|
1529
|
-
let activeSlideIndex = parseInt(firstSlideInColumn.getAttribute('data-swiper-slide-index'), 10);
|
|
1530
|
-
if (Number.isNaN(activeSlideIndex)) {
|
|
1531
|
-
activeSlideIndex = Math.max(swiper.slides.indexOf(firstSlideInColumn), 0);
|
|
1532
|
-
}
|
|
1533
|
-
realIndex = Math.floor(activeSlideIndex / params.grid.rows);
|
|
1534
|
-
} else if (swiper.slides[activeIndex]) {
|
|
1426
|
+
let realIndex = activeIndex;
|
|
1427
|
+
if (swiper.slides[activeIndex]) {
|
|
1535
1428
|
const slideIndex = swiper.slides[activeIndex].getAttribute('data-swiper-slide-index');
|
|
1536
1429
|
if (slideIndex) {
|
|
1537
1430
|
realIndex = parseInt(slideIndex, 10);
|
|
1538
|
-
} else {
|
|
1539
|
-
realIndex = activeIndex;
|
|
1540
1431
|
}
|
|
1541
|
-
} else {
|
|
1542
|
-
realIndex = activeIndex;
|
|
1543
1432
|
}
|
|
1544
1433
|
Object.assign(swiper, {
|
|
1545
1434
|
previousSnapIndex,
|
|
@@ -1586,11 +1475,7 @@ var Swiper = (function () {
|
|
|
1586
1475
|
}
|
|
1587
1476
|
if (slide && slideFound) {
|
|
1588
1477
|
swiper.clickedSlide = slide;
|
|
1589
|
-
|
|
1590
|
-
swiper.clickedIndex = parseInt(slide.getAttribute('data-swiper-slide-index'), 10);
|
|
1591
|
-
} else {
|
|
1592
|
-
swiper.clickedIndex = slideIndex;
|
|
1593
|
-
}
|
|
1478
|
+
swiper.clickedIndex = slideIndex;
|
|
1594
1479
|
} else {
|
|
1595
1480
|
swiper.clickedSlide = undefined;
|
|
1596
1481
|
swiper.clickedIndex = undefined;
|
|
@@ -1624,9 +1509,6 @@ var Swiper = (function () {
|
|
|
1624
1509
|
translate,
|
|
1625
1510
|
wrapperEl
|
|
1626
1511
|
} = swiper;
|
|
1627
|
-
if (params.virtualTranslate) {
|
|
1628
|
-
return rtl ? -translate : translate;
|
|
1629
|
-
}
|
|
1630
1512
|
if (params.cssMode) {
|
|
1631
1513
|
return translate;
|
|
1632
1514
|
}
|
|
@@ -1660,7 +1542,7 @@ var Swiper = (function () {
|
|
|
1660
1542
|
swiper.translate = swiper.isHorizontal() ? x : y;
|
|
1661
1543
|
if (params.cssMode) {
|
|
1662
1544
|
wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y;
|
|
1663
|
-
} else
|
|
1545
|
+
} else {
|
|
1664
1546
|
if (swiper.isHorizontal()) {
|
|
1665
1547
|
x -= swiper.cssOverflowAdjustment();
|
|
1666
1548
|
} else {
|
|
@@ -1897,7 +1779,6 @@ var Swiper = (function () {
|
|
|
1897
1779
|
let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup);
|
|
1898
1780
|
if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1;
|
|
1899
1781
|
const translate = -snapGrid[snapIndex];
|
|
1900
|
-
// Normalize slideIndex
|
|
1901
1782
|
if (params.normalizeSlideIndex) {
|
|
1902
1783
|
for (let i = 0; i < slidesGrid.length; i += 1) {
|
|
1903
1784
|
const normalizedTranslate = -Math.floor(translate * 100);
|
|
@@ -1914,33 +1795,24 @@ var Swiper = (function () {
|
|
|
1914
1795
|
}
|
|
1915
1796
|
}
|
|
1916
1797
|
}
|
|
1798
|
+
|
|
1917
1799
|
// Directions locks
|
|
1918
1800
|
if (swiper.initialized && slideIndex !== activeIndex) {
|
|
1919
1801
|
if (!swiper.allowSlideNext && (rtl ? translate > swiper.translate && translate > swiper.minTranslate() : translate < swiper.translate && translate < swiper.minTranslate())) {
|
|
1920
1802
|
return false;
|
|
1921
1803
|
}
|
|
1922
1804
|
if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) {
|
|
1923
|
-
if ((activeIndex || 0) !== slideIndex)
|
|
1924
|
-
return false;
|
|
1925
|
-
}
|
|
1805
|
+
if ((activeIndex || 0) !== slideIndex) return false;
|
|
1926
1806
|
}
|
|
1927
1807
|
}
|
|
1928
1808
|
if (slideIndex !== (previousIndex || 0) && runCallbacks) {
|
|
1929
1809
|
swiper.emit('beforeSlideChangeStart');
|
|
1930
1810
|
}
|
|
1931
|
-
|
|
1932
|
-
// Update progress
|
|
1933
1811
|
swiper.updateProgress(translate);
|
|
1934
1812
|
let direction;
|
|
1935
1813
|
if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset';
|
|
1936
|
-
|
|
1937
|
-
// initial virtual
|
|
1938
|
-
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
|
|
1939
|
-
const isInitialVirtual = isVirtual && initial;
|
|
1940
|
-
// Update Index
|
|
1941
|
-
if (!isInitialVirtual && (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate)) {
|
|
1814
|
+
if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) {
|
|
1942
1815
|
swiper.updateActiveIndex(slideIndex);
|
|
1943
|
-
// Update Height
|
|
1944
1816
|
if (params.autoHeight) {
|
|
1945
1817
|
swiper.updateAutoHeight();
|
|
1946
1818
|
}
|
|
@@ -1958,24 +1830,7 @@ var Swiper = (function () {
|
|
|
1958
1830
|
const isH = swiper.isHorizontal();
|
|
1959
1831
|
const t = rtl ? translate : -translate;
|
|
1960
1832
|
if (speed === 0) {
|
|
1961
|
-
|
|
1962
|
-
swiper.wrapperEl.style.scrollSnapType = 'none';
|
|
1963
|
-
swiper._immediateVirtual = true;
|
|
1964
|
-
}
|
|
1965
|
-
if (isVirtual && !swiper._cssModeVirtualInitialSet && swiper.params.initialSlide > 0) {
|
|
1966
|
-
swiper._cssModeVirtualInitialSet = true;
|
|
1967
|
-
requestAnimationFrame(() => {
|
|
1968
|
-
wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
|
|
1969
|
-
});
|
|
1970
|
-
} else {
|
|
1971
|
-
wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
|
|
1972
|
-
}
|
|
1973
|
-
if (isVirtual) {
|
|
1974
|
-
requestAnimationFrame(() => {
|
|
1975
|
-
swiper.wrapperEl.style.scrollSnapType = '';
|
|
1976
|
-
swiper._immediateVirtual = false;
|
|
1977
|
-
});
|
|
1978
|
-
}
|
|
1833
|
+
wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t;
|
|
1979
1834
|
} else {
|
|
1980
1835
|
if (!swiper.support.smoothScroll) {
|
|
1981
1836
|
animateCSSModeScroll({
|
|
@@ -1993,10 +1848,7 @@ var Swiper = (function () {
|
|
|
1993
1848
|
return true;
|
|
1994
1849
|
}
|
|
1995
1850
|
const browser = getBrowser();
|
|
1996
|
-
|
|
1997
|
-
if (isVirtual && !initial && isSafari && swiper.isElement) {
|
|
1998
|
-
swiper.virtual.update(false, false, slideIndex);
|
|
1999
|
-
}
|
|
1851
|
+
browser.isSafari;
|
|
2000
1852
|
swiper.setTransition(speed);
|
|
2001
1853
|
swiper.setTranslate(translate);
|
|
2002
1854
|
swiper.updateActiveIndex(slideIndex);
|
|
@@ -2167,8 +2019,6 @@ var Swiper = (function () {
|
|
|
2167
2019
|
if (swiper.params?.isSneakPeekCenter && slides.length > 1 && swiper.activeIndex === 0) {
|
|
2168
2020
|
const gap = Math.abs(swiper.snapGrid[1] - swiper.snapGrid[0]);
|
|
2169
2021
|
const swiperTranslate = JSON.parse(JSON.stringify(swiper.snapGrid[1]));
|
|
2170
|
-
|
|
2171
|
-
// Move last item to first position only if active slide is the first slide
|
|
2172
2022
|
const lastSlide = slides[slides.length - 1];
|
|
2173
2023
|
lastSlide.swiperLoopMoveDOM = true;
|
|
2174
2024
|
swiper.slidesEl.prepend(lastSlide);
|
|
@@ -2203,11 +2053,8 @@ var Swiper = (function () {
|
|
|
2203
2053
|
perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1);
|
|
2204
2054
|
}
|
|
2205
2055
|
const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup;
|
|
2206
|
-
const isVirtual = swiper.virtual && params.virtual.enabled;
|
|
2207
2056
|
if (params.loop) {
|
|
2208
|
-
if (animating &&
|
|
2209
|
-
|
|
2210
|
-
// Kiểm tra xem loop có bị disable không
|
|
2057
|
+
if (animating && params.loopPreventsSliding) return false;
|
|
2211
2058
|
const currentSlidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10));
|
|
2212
2059
|
if (swiper.slides.length >= currentSlidesPerView) {
|
|
2213
2060
|
swiper.loopFix({
|
|
@@ -2234,7 +2081,6 @@ var Swiper = (function () {
|
|
|
2234
2081
|
const gap = Math.abs(swiper.snapGrid[lastSnapGridIndex] - swiper.snapGrid[lastSnapGridIndex - 1]);
|
|
2235
2082
|
const swiperTranslate = structuredClone(swiper.snapGrid[lastSnapGridIndex - 1]);
|
|
2236
2083
|
if (!swiper.params.loop) return;
|
|
2237
|
-
// Move first item to last position only if active slide is the last slide
|
|
2238
2084
|
const firstSlide = slides[0];
|
|
2239
2085
|
firstSlide.swiperLoopMoveDOM = true;
|
|
2240
2086
|
swiper.slidesEl.append(firstSlide);
|
|
@@ -2259,17 +2105,14 @@ var Swiper = (function () {
|
|
|
2259
2105
|
params,
|
|
2260
2106
|
snapGrid,
|
|
2261
2107
|
slidesGrid,
|
|
2262
|
-
rtlTranslate,
|
|
2263
|
-
enabled
|
|
2264
|
-
animating
|
|
2108
|
+
rtlTranslate: rtlTranslate,
|
|
2109
|
+
enabled
|
|
2265
2110
|
} = swiper;
|
|
2266
2111
|
if (!enabled || swiper.destroyed) return swiper;
|
|
2267
2112
|
if (typeof speed === 'undefined') {
|
|
2268
2113
|
speed = swiper.params.speed;
|
|
2269
2114
|
}
|
|
2270
|
-
swiper.virtual && params.virtual.enabled;
|
|
2271
2115
|
if (params.loop) {
|
|
2272
|
-
// Kiểm tra xem loop có bị disable không
|
|
2273
2116
|
const currentSlidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(params.slidesPerView, 10));
|
|
2274
2117
|
if (swiper.slides.length >= currentSlidesPerView) {
|
|
2275
2118
|
swiper.loopFix({
|
|
@@ -2286,18 +2129,16 @@ var Swiper = (function () {
|
|
|
2286
2129
|
}
|
|
2287
2130
|
const normalizedTranslate = normalize(translate);
|
|
2288
2131
|
const normalizedSnapGrid = snapGrid.map(val => normalize(val));
|
|
2289
|
-
const isFreeMode = params.freeMode && params.freeMode.enabled;
|
|
2290
2132
|
let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1];
|
|
2291
|
-
if (typeof prevSnap === 'undefined' &&
|
|
2133
|
+
if (typeof prevSnap === 'undefined' && params.cssMode) {
|
|
2292
2134
|
let prevSnapIndex;
|
|
2293
2135
|
snapGrid.forEach((snap, snapIndex) => {
|
|
2294
2136
|
if (normalizedTranslate >= snap) {
|
|
2295
|
-
// prevSnap = snap;
|
|
2296
2137
|
prevSnapIndex = snapIndex;
|
|
2297
2138
|
}
|
|
2298
2139
|
});
|
|
2299
2140
|
if (typeof prevSnapIndex !== 'undefined') {
|
|
2300
|
-
prevSnap =
|
|
2141
|
+
prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex];
|
|
2301
2142
|
}
|
|
2302
2143
|
}
|
|
2303
2144
|
let prevIndex = 0;
|
|
@@ -2310,7 +2151,7 @@ var Swiper = (function () {
|
|
|
2310
2151
|
}
|
|
2311
2152
|
}
|
|
2312
2153
|
if (params.rewind && swiper.isBeginning) {
|
|
2313
|
-
const lastIndex = swiper.
|
|
2154
|
+
const lastIndex = swiper.slides.length - 1;
|
|
2314
2155
|
return swiper.slideTo(lastIndex, speed, runCallbacks, internal);
|
|
2315
2156
|
} else if (params.loop && swiper.activeIndex === 0 && params.cssMode) {
|
|
2316
2157
|
requestAnimationFrame(() => {
|
|
@@ -2324,8 +2165,6 @@ var Swiper = (function () {
|
|
|
2324
2165
|
if (swiper.params?.isSneakPeekCenter && slides.length > 1 && swiper.activeIndex === 0) {
|
|
2325
2166
|
const gap = Math.abs(swiper.snapGrid[1] - swiper.snapGrid[0]);
|
|
2326
2167
|
const swiperTranslate = JSON.parse(JSON.stringify(swiper.snapGrid[1]));
|
|
2327
|
-
|
|
2328
|
-
// Move last item to first position only if active slide is the first slide
|
|
2329
2168
|
if (!swiper.params.loop) return;
|
|
2330
2169
|
const lastSlide = slides[slides.length - 1];
|
|
2331
2170
|
lastSlide.swiperLoopMoveDOM = true;
|
|
@@ -2402,20 +2241,19 @@ var Swiper = (function () {
|
|
|
2402
2241
|
slidesEl
|
|
2403
2242
|
} = swiper;
|
|
2404
2243
|
const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView;
|
|
2405
|
-
|
|
2244
|
+
const slideToIndex = swiper.clickedIndex;
|
|
2406
2245
|
let realIndex;
|
|
2407
2246
|
const slideSelector = swiper.isElement ? `swiper-slide` : `.${params.slideClass}`;
|
|
2408
|
-
const isGrid = swiper.grid && swiper.params.grid && swiper.params.grid.rows > 1;
|
|
2409
2247
|
if (params.loop) {
|
|
2410
2248
|
if (swiper.animating) return;
|
|
2411
2249
|
realIndex = parseInt(swiper.clickedSlide.getAttribute('data-swiper-slide-index'), 10);
|
|
2412
2250
|
if (params.centeredSlides) {
|
|
2413
2251
|
swiper.slideToLoop(realIndex);
|
|
2414
|
-
} else if (slideToIndex >
|
|
2252
|
+
} else if (slideToIndex > swiper.slides.length - slidesPerView) {
|
|
2415
2253
|
swiper.loopFix();
|
|
2416
|
-
|
|
2254
|
+
const clickedEl = elementChildren(slidesEl, `${slideSelector}[data-swiper-slide-index="${realIndex}"]`)[0];
|
|
2417
2255
|
nextTick(() => {
|
|
2418
|
-
swiper.slideTo(
|
|
2256
|
+
if (clickedEl) swiper.slideTo(swiper.getSlideIndex(clickedEl));
|
|
2419
2257
|
});
|
|
2420
2258
|
} else {
|
|
2421
2259
|
swiper.slideTo(slideToIndex);
|
|
@@ -2442,7 +2280,7 @@ var Swiper = (function () {
|
|
|
2442
2280
|
params,
|
|
2443
2281
|
slidesEl
|
|
2444
2282
|
} = swiper;
|
|
2445
|
-
if (!params.loop
|
|
2283
|
+
if (!params.loop) return;
|
|
2446
2284
|
const initSlides = () => {
|
|
2447
2285
|
const slides = elementChildren(slidesEl, `.${params.slideClass}, swiper-slide`);
|
|
2448
2286
|
slides.forEach((el, index) => {
|
|
@@ -2451,21 +2289,17 @@ var Swiper = (function () {
|
|
|
2451
2289
|
};
|
|
2452
2290
|
const clearBlankSlides = () => {
|
|
2453
2291
|
const slides = elementChildren(slidesEl, `.${params.slideBlankClass}`);
|
|
2454
|
-
slides.forEach(el =>
|
|
2455
|
-
el.remove();
|
|
2456
|
-
});
|
|
2292
|
+
slides.forEach(el => el.remove());
|
|
2457
2293
|
if (slides.length > 0) {
|
|
2458
2294
|
swiper.recalcSlides();
|
|
2459
2295
|
swiper.updateSlides();
|
|
2460
2296
|
}
|
|
2461
2297
|
};
|
|
2462
|
-
|
|
2463
|
-
if (params.loopAddBlankSlides && (params.slidesPerGroup > 1 || gridEnabled)) {
|
|
2298
|
+
if (params.loopAddBlankSlides && params.slidesPerGroup > 1) {
|
|
2464
2299
|
clearBlankSlides();
|
|
2465
2300
|
}
|
|
2466
|
-
const slidesPerGroup = params.slidesPerGroup
|
|
2301
|
+
const slidesPerGroup = params.slidesPerGroup;
|
|
2467
2302
|
const shouldFillGroup = swiper.slides.length % slidesPerGroup !== 0;
|
|
2468
|
-
const shouldFillGrid = gridEnabled && swiper.slides.length % params.grid.rows !== 0;
|
|
2469
2303
|
const addBlankSlides = amountOfSlides => {
|
|
2470
2304
|
for (let i = 0; i < amountOfSlides; i += 1) {
|
|
2471
2305
|
const slideEl = swiper.isElement ? createElement('swiper-slide', [params.slideBlankClass]) : createElement('div', [params.slideClass, params.slideBlankClass]);
|
|
@@ -2482,16 +2316,6 @@ var Swiper = (function () {
|
|
|
2482
2316
|
showWarning('Swiper Loop Warning: The number of slides is not even to slidesPerGroup, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)');
|
|
2483
2317
|
}
|
|
2484
2318
|
initSlides();
|
|
2485
|
-
} else if (shouldFillGrid) {
|
|
2486
|
-
if (params.loopAddBlankSlides) {
|
|
2487
|
-
const slidesToAdd = params.grid.rows - swiper.slides.length % params.grid.rows;
|
|
2488
|
-
addBlankSlides(slidesToAdd);
|
|
2489
|
-
swiper.recalcSlides();
|
|
2490
|
-
swiper.updateSlides();
|
|
2491
|
-
} else {
|
|
2492
|
-
showWarning('Swiper Loop Warning: The number of slides is not even to grid.rows, loop mode may not function properly. You need to add more slides (or make duplicates, or empty slides)');
|
|
2493
|
-
}
|
|
2494
|
-
initSlides();
|
|
2495
2319
|
} else {
|
|
2496
2320
|
initSlides();
|
|
2497
2321
|
}
|
|
@@ -2510,13 +2334,12 @@ var Swiper = (function () {
|
|
|
2510
2334
|
setTranslate,
|
|
2511
2335
|
activeSlideIndex,
|
|
2512
2336
|
initial,
|
|
2513
|
-
byController,
|
|
2514
2337
|
byMousewheel
|
|
2515
2338
|
} = _temp === void 0 ? {} : _temp;
|
|
2516
2339
|
const swiper = this;
|
|
2517
2340
|
if (!swiper.params.loop) return;
|
|
2518
2341
|
|
|
2519
|
-
// Disable loop mode
|
|
2342
|
+
// Disable loop mode if number of slides is smaller than slidesPerView
|
|
2520
2343
|
const currentSlidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
|
|
2521
2344
|
if (swiper.slides.length < currentSlidesPerView) {
|
|
2522
2345
|
console.warn('Swiper: Loop mode disabled - slides.length < slidesPerView');
|
|
@@ -2536,21 +2359,6 @@ var Swiper = (function () {
|
|
|
2536
2359
|
} = params;
|
|
2537
2360
|
swiper.allowSlidePrev = true;
|
|
2538
2361
|
swiper.allowSlideNext = true;
|
|
2539
|
-
if (swiper.virtual && params.virtual.enabled) {
|
|
2540
|
-
if (slideTo) {
|
|
2541
|
-
if (!params.centeredSlides && swiper.snapIndex === 0) {
|
|
2542
|
-
swiper.slideTo(swiper.virtual.slides.length, 0, false, true);
|
|
2543
|
-
} else if (params.centeredSlides && swiper.snapIndex < params.slidesPerView) {
|
|
2544
|
-
swiper.slideTo(swiper.virtual.slides.length + swiper.snapIndex, 0, false, true);
|
|
2545
|
-
} else if (swiper.snapIndex === swiper.snapGrid.length - 1) {
|
|
2546
|
-
swiper.slideTo(swiper.virtual.slidesBefore, 0, false, true);
|
|
2547
|
-
}
|
|
2548
|
-
}
|
|
2549
|
-
swiper.allowSlidePrev = allowSlidePrev;
|
|
2550
|
-
swiper.allowSlideNext = allowSlideNext;
|
|
2551
|
-
swiper.emit('loopFix');
|
|
2552
|
-
return;
|
|
2553
|
-
}
|
|
2554
2362
|
let slidesPerView = params.slidesPerView;
|
|
2555
2363
|
if (slidesPerView === 'auto') {
|
|
2556
2364
|
slidesPerView = swiper.slidesPerViewDynamic();
|
|
@@ -2560,22 +2368,19 @@ var Swiper = (function () {
|
|
|
2560
2368
|
slidesPerView = slidesPerView + 1;
|
|
2561
2369
|
}
|
|
2562
2370
|
}
|
|
2563
|
-
const slidesPerGroup = params.
|
|
2371
|
+
const slidesPerGroup = params.slidesPerGroup;
|
|
2564
2372
|
let loopedSlides = centeredSlides ? Math.max(slidesPerGroup, Math.ceil(slidesPerView / 2)) : slidesPerGroup;
|
|
2565
2373
|
if (loopedSlides % slidesPerGroup !== 0) {
|
|
2566
2374
|
loopedSlides += slidesPerGroup - loopedSlides % slidesPerGroup;
|
|
2567
2375
|
}
|
|
2568
2376
|
loopedSlides += params.loopAdditionalSlides;
|
|
2569
2377
|
swiper.loopedSlides = loopedSlides;
|
|
2570
|
-
|
|
2571
|
-
if (slides.length < slidesPerView + loopedSlides || swiper.params.effect === 'cards' && slides.length < slidesPerView + loopedSlides * 2) {
|
|
2378
|
+
if (slides.length < slidesPerView + loopedSlides) {
|
|
2572
2379
|
showWarning('Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled or not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters');
|
|
2573
|
-
} else if (gridEnabled && params.grid.fill === 'row') {
|
|
2574
|
-
showWarning('Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`');
|
|
2575
2380
|
}
|
|
2576
2381
|
const prependSlidesIndexes = [];
|
|
2577
2382
|
const appendSlidesIndexes = [];
|
|
2578
|
-
const cols =
|
|
2383
|
+
const cols = slides.length;
|
|
2579
2384
|
const isInitialOverflow = initial && cols - initialSlide < slidesPerView && !centeredSlides;
|
|
2580
2385
|
let activeIndex = isInitialOverflow ? initialSlide : swiper.activeIndex;
|
|
2581
2386
|
if (typeof activeSlideIndex === 'undefined') {
|
|
@@ -2587,24 +2392,15 @@ var Swiper = (function () {
|
|
|
2587
2392
|
const isPrev = direction === 'prev' || !direction;
|
|
2588
2393
|
let slidesPrepended = 0;
|
|
2589
2394
|
let slidesAppended = 0;
|
|
2590
|
-
const activeColIndex =
|
|
2395
|
+
const activeColIndex = activeSlideIndex;
|
|
2591
2396
|
const activeColIndexWithShift = activeColIndex + (centeredSlides && typeof setTranslate === 'undefined' ? -slidesPerView / 2 + 0.5 : 0);
|
|
2397
|
+
|
|
2592
2398
|
// prepend last slides before start
|
|
2593
2399
|
if (activeColIndexWithShift < loopedSlides) {
|
|
2594
2400
|
slidesPrepended = Math.max(loopedSlides - activeColIndexWithShift, slidesPerGroup);
|
|
2595
2401
|
for (let i = 0; i < loopedSlides - activeColIndexWithShift; i += 1) {
|
|
2596
2402
|
const index = i - Math.floor(i / cols) * cols;
|
|
2597
|
-
|
|
2598
|
-
const colIndexToPrepend = cols - index - 1;
|
|
2599
|
-
for (let i = slides.length - 1; i >= 0; i -= 1) {
|
|
2600
|
-
if (slides[i].column === colIndexToPrepend) prependSlidesIndexes.push(i);
|
|
2601
|
-
}
|
|
2602
|
-
// slides.forEach((slide, slideIndex) => {
|
|
2603
|
-
// if (slide.column === colIndexToPrepend) prependSlidesIndexes.push(slideIndex);
|
|
2604
|
-
// });
|
|
2605
|
-
} else {
|
|
2606
|
-
prependSlidesIndexes.push(cols - index - 1);
|
|
2607
|
-
}
|
|
2403
|
+
prependSlidesIndexes.push(cols - index - 1);
|
|
2608
2404
|
}
|
|
2609
2405
|
} else if (activeColIndexWithShift + slidesPerView > cols - loopedSlides) {
|
|
2610
2406
|
slidesAppended = Math.max(activeColIndexWithShift - (cols - loopedSlides * 2), slidesPerGroup);
|
|
@@ -2613,27 +2409,13 @@ var Swiper = (function () {
|
|
|
2613
2409
|
}
|
|
2614
2410
|
for (let i = 0; i < slidesAppended; i += 1) {
|
|
2615
2411
|
const index = i - Math.floor(i / cols) * cols;
|
|
2616
|
-
|
|
2617
|
-
slides.forEach((slide, slideIndex) => {
|
|
2618
|
-
if (slide.column === index) appendSlidesIndexes.push(slideIndex);
|
|
2619
|
-
});
|
|
2620
|
-
} else {
|
|
2621
|
-
appendSlidesIndexes.push(index);
|
|
2622
|
-
}
|
|
2412
|
+
appendSlidesIndexes.push(index);
|
|
2623
2413
|
}
|
|
2624
2414
|
}
|
|
2625
2415
|
swiper.__preventObserver__ = true;
|
|
2626
2416
|
requestAnimationFrame(() => {
|
|
2627
2417
|
swiper.__preventObserver__ = false;
|
|
2628
2418
|
});
|
|
2629
|
-
if (swiper.params.effect === 'cards' && slides.length < slidesPerView + loopedSlides * 2) {
|
|
2630
|
-
if (appendSlidesIndexes.includes(activeSlideIndex)) {
|
|
2631
|
-
appendSlidesIndexes.splice(appendSlidesIndexes.indexOf(activeSlideIndex), 1);
|
|
2632
|
-
}
|
|
2633
|
-
if (prependSlidesIndexes.includes(activeSlideIndex)) {
|
|
2634
|
-
prependSlidesIndexes.splice(prependSlidesIndexes.indexOf(activeSlideIndex), 1);
|
|
2635
|
-
}
|
|
2636
|
-
}
|
|
2637
2419
|
if (isPrev) {
|
|
2638
2420
|
prependSlidesIndexes.forEach(index => {
|
|
2639
2421
|
slides[index].swiperLoopMoveDOM = true;
|
|
@@ -2651,10 +2433,6 @@ var Swiper = (function () {
|
|
|
2651
2433
|
swiper.recalcSlides();
|
|
2652
2434
|
if (params.slidesPerView === 'auto') {
|
|
2653
2435
|
swiper.updateSlides();
|
|
2654
|
-
} else if (gridEnabled && (prependSlidesIndexes.length > 0 && isPrev || appendSlidesIndexes.length > 0 && isNext)) {
|
|
2655
|
-
swiper.slides.forEach((slide, slideIndex) => {
|
|
2656
|
-
swiper.grid.updateSlide(slideIndex, slide, swiper.slides);
|
|
2657
|
-
});
|
|
2658
2436
|
}
|
|
2659
2437
|
if (params.watchSlidesProgress) {
|
|
2660
2438
|
swiper.updateSlidesOffset();
|
|
@@ -2674,12 +2452,10 @@ var Swiper = (function () {
|
|
|
2674
2452
|
swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
|
|
2675
2453
|
}
|
|
2676
2454
|
}
|
|
2677
|
-
} else {
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
swiper.touchEventsData.currentTranslate = swiper.translate;
|
|
2682
|
-
}
|
|
2455
|
+
} else if (setTranslate) {
|
|
2456
|
+
const shift = prependSlidesIndexes.length;
|
|
2457
|
+
swiper.slideTo(swiper.activeIndex + shift, 0, false, true);
|
|
2458
|
+
swiper.touchEventsData.currentTranslate = swiper.translate;
|
|
2683
2459
|
}
|
|
2684
2460
|
} else if (appendSlidesIndexes.length > 0 && isNext) {
|
|
2685
2461
|
if (typeof slideRealIndex === 'undefined') {
|
|
@@ -2695,36 +2471,14 @@ var Swiper = (function () {
|
|
|
2695
2471
|
swiper.touchEventsData.currentTranslate = swiper.touchEventsData.currentTranslate - diff;
|
|
2696
2472
|
}
|
|
2697
2473
|
}
|
|
2698
|
-
} else {
|
|
2699
|
-
const shift =
|
|
2474
|
+
} else if (setTranslate) {
|
|
2475
|
+
const shift = appendSlidesIndexes.length;
|
|
2700
2476
|
swiper.slideTo(swiper.activeIndex - shift, 0, false, true);
|
|
2701
2477
|
}
|
|
2702
2478
|
}
|
|
2703
2479
|
}
|
|
2704
2480
|
swiper.allowSlidePrev = allowSlidePrev;
|
|
2705
2481
|
swiper.allowSlideNext = allowSlideNext;
|
|
2706
|
-
if (swiper.controller && swiper.controller.control && !byController) {
|
|
2707
|
-
const loopParams = {
|
|
2708
|
-
slideRealIndex,
|
|
2709
|
-
direction,
|
|
2710
|
-
setTranslate,
|
|
2711
|
-
activeSlideIndex,
|
|
2712
|
-
byController: true
|
|
2713
|
-
};
|
|
2714
|
-
if (Array.isArray(swiper.controller.control)) {
|
|
2715
|
-
swiper.controller.control.forEach(c => {
|
|
2716
|
-
if (!c.destroyed && c.params.loop) c.loopFix({
|
|
2717
|
-
...loopParams,
|
|
2718
|
-
slideTo: c.params.slidesPerView === params.slidesPerView ? slideTo : false
|
|
2719
|
-
});
|
|
2720
|
-
});
|
|
2721
|
-
} else if (swiper.controller.control instanceof swiper.constructor && swiper.controller.control.params.loop) {
|
|
2722
|
-
swiper.controller.control.loopFix({
|
|
2723
|
-
...loopParams,
|
|
2724
|
-
slideTo: swiper.controller.control.params.slidesPerView === params.slidesPerView ? slideTo : false
|
|
2725
|
-
});
|
|
2726
|
-
}
|
|
2727
|
-
}
|
|
2728
2482
|
swiper.emit('loopFix');
|
|
2729
2483
|
}
|
|
2730
2484
|
|
|
@@ -2741,7 +2495,7 @@ var Swiper = (function () {
|
|
|
2741
2495
|
const swiper = this;
|
|
2742
2496
|
if (!swiper.params.loop) return;
|
|
2743
2497
|
|
|
2744
|
-
// Disable loop mode
|
|
2498
|
+
// Disable loop mode if number of slides is smaller than slidesPerView
|
|
2745
2499
|
const currentSlidesPerView = swiper.params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : Math.ceil(parseFloat(swiper.params.slidesPerView, 10));
|
|
2746
2500
|
if (swiper.slides.length < currentSlidesPerView) {
|
|
2747
2501
|
console.warn('Swiper: Loop mode disabled - slides.length < slidesPerView');
|
|
@@ -2780,7 +2534,7 @@ var Swiper = (function () {
|
|
|
2780
2534
|
}
|
|
2781
2535
|
loopedSlides += params.loopAdditionalSlides;
|
|
2782
2536
|
swiper.loopedSlides = loopedSlides;
|
|
2783
|
-
if (slides.length < slidesPerView + loopedSlides
|
|
2537
|
+
if (slides.length < slidesPerView + loopedSlides) {
|
|
2784
2538
|
showWarning('Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled or not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters');
|
|
2785
2539
|
}
|
|
2786
2540
|
const isNext = direction === 'next' || !direction;
|
|
@@ -2806,20 +2560,16 @@ var Swiper = (function () {
|
|
|
2806
2560
|
activeSlideIndex = swiper.getSlideIndex(slides.find(el => el.classList.contains(params.slideActiveClass)));
|
|
2807
2561
|
}
|
|
2808
2562
|
|
|
2809
|
-
//
|
|
2563
|
+
// DocumentFragment to hold slide clones
|
|
2810
2564
|
const cloneFragment = document.createDocumentFragment();
|
|
2811
2565
|
|
|
2812
|
-
// Clone
|
|
2566
|
+
// Clone slides according to numberOfSlidesNeedClone and append to fragment
|
|
2813
2567
|
(isNext ? numberOfSlidesNeedClone : numberOfSlidesNeedClone.reverse()).forEach(index => {
|
|
2814
2568
|
if (slides[index]) {
|
|
2815
2569
|
const originalSlide = slides[index];
|
|
2816
2570
|
const clonedSlide = originalSlide.cloneNode(true);
|
|
2817
|
-
|
|
2818
|
-
// Đánh dấu slide clone
|
|
2819
2571
|
clonedSlide.setAttribute('data-swiper-clone', 'true');
|
|
2820
2572
|
clonedSlide.classList.add('swiper-slide-clone');
|
|
2821
|
-
|
|
2822
|
-
// Thêm clone vào fragment
|
|
2823
2573
|
cloneFragment.appendChild(clonedSlide);
|
|
2824
2574
|
}
|
|
2825
2575
|
});
|
|
@@ -2840,32 +2590,28 @@ var Swiper = (function () {
|
|
|
2840
2590
|
});
|
|
2841
2591
|
}
|
|
2842
2592
|
|
|
2843
|
-
//
|
|
2593
|
+
// Sort cloned slides by data-swiper-slide-index
|
|
2844
2594
|
const clonedSlides = Array.from(cloneFragment.children);
|
|
2845
2595
|
clonedSlides.sort((a, b) => {
|
|
2846
2596
|
const indexA = parseInt(a.getAttribute('data-swiper-slide-index')) || 0;
|
|
2847
2597
|
const indexB = parseInt(b.getAttribute('data-swiper-slide-index')) || 0;
|
|
2848
2598
|
return indexA - indexB;
|
|
2849
2599
|
});
|
|
2850
|
-
|
|
2851
|
-
// Xóa tất cả children cũ và thêm lại theo thứ tự đã sắp xếp
|
|
2852
2600
|
cloneFragment.innerHTML = '';
|
|
2853
2601
|
clonedSlides.forEach(slide => {
|
|
2854
2602
|
cloneFragment.appendChild(slide);
|
|
2855
2603
|
});
|
|
2856
2604
|
|
|
2857
|
-
//
|
|
2605
|
+
// Place fragment into the right position
|
|
2858
2606
|
if (isPrev) {
|
|
2859
|
-
// Nếu là prev, thêm fragment vào cuối slidesEl
|
|
2860
2607
|
slidesEl.appendChild(cloneFragment);
|
|
2861
2608
|
} else if (isNext) {
|
|
2862
|
-
// Nếu là next, thêm fragment vào đầu slidesEl
|
|
2863
2609
|
slidesEl.insertBefore(cloneFragment, slidesEl.firstChild);
|
|
2864
2610
|
}
|
|
2865
2611
|
swiper.recalcSlides();
|
|
2866
2612
|
swiper.updateSlides();
|
|
2867
2613
|
|
|
2868
|
-
//
|
|
2614
|
+
// Find old active slide index after recalculation
|
|
2869
2615
|
let oldActiveIndex = null;
|
|
2870
2616
|
for (let i = 0; i < slidesEl.children.length; i++) {
|
|
2871
2617
|
const child = slidesEl.children[i];
|
|
@@ -2878,7 +2624,7 @@ var Swiper = (function () {
|
|
|
2878
2624
|
swiper.slideTo(oldActiveIndex, 0);
|
|
2879
2625
|
}
|
|
2880
2626
|
|
|
2881
|
-
//
|
|
2627
|
+
// Update translate after removing clones for animation
|
|
2882
2628
|
const skip = Math.min(swiper.params.slidesPerGroupSkip, newIndex);
|
|
2883
2629
|
let snapIndex = skip + Math.floor((newIndex - skip) / swiper.params.slidesPerGroup);
|
|
2884
2630
|
if (snapIndex >= swiper.snapGrid.length) snapIndex = swiper.snapGrid.length - 1;
|
|
@@ -2904,7 +2650,8 @@ var Swiper = (function () {
|
|
|
2904
2650
|
}
|
|
2905
2651
|
swiper.setTranslate(updateTranslate);
|
|
2906
2652
|
}
|
|
2907
|
-
|
|
2653
|
+
|
|
2654
|
+
// Remove clones
|
|
2908
2655
|
const cloneSlides = slidesEl.querySelectorAll('[data-swiper-clone="true"]');
|
|
2909
2656
|
cloneSlides.forEach(cloneSlide => {
|
|
2910
2657
|
if (cloneSlide.parentNode) {
|
|
@@ -2934,7 +2681,7 @@ var Swiper = (function () {
|
|
|
2934
2681
|
params,
|
|
2935
2682
|
slidesEl
|
|
2936
2683
|
} = swiper;
|
|
2937
|
-
if (!params.loop || !slidesEl
|
|
2684
|
+
if (!params.loop || !slidesEl) return;
|
|
2938
2685
|
swiper.recalcSlides();
|
|
2939
2686
|
const newSlidesOrder = [];
|
|
2940
2687
|
swiper.slides.forEach(slideEl => {
|
|
@@ -2995,7 +2742,6 @@ var Swiper = (function () {
|
|
|
2995
2742
|
unsetGrabCursor
|
|
2996
2743
|
};
|
|
2997
2744
|
|
|
2998
|
-
// Modified from https://stackoverflow.com/questions/54520554/custom-element-getrootnode-closest-function-crossing-multiple-parent-shadowd
|
|
2999
2745
|
function closestElement(selector, base) {
|
|
3000
2746
|
if (base === void 0) {
|
|
3001
2747
|
base = this;
|
|
@@ -3004,9 +2750,7 @@ var Swiper = (function () {
|
|
|
3004
2750
|
if (!el || el === getDocument() || el === getWindow()) return null;
|
|
3005
2751
|
if (el.assignedSlot) el = el.assignedSlot;
|
|
3006
2752
|
const found = el.closest(selector);
|
|
3007
|
-
if (!found && !el.getRootNode)
|
|
3008
|
-
return null;
|
|
3009
|
-
}
|
|
2753
|
+
if (!found && !el.getRootNode) return null;
|
|
3010
2754
|
return found || __closestFrom(el.getRootNode().host);
|
|
3011
2755
|
}
|
|
3012
2756
|
return __closestFrom(base);
|
|
@@ -3034,9 +2778,7 @@ var Swiper = (function () {
|
|
|
3034
2778
|
if (e.originalEvent) e = e.originalEvent;
|
|
3035
2779
|
const data = swiper.touchEventsData;
|
|
3036
2780
|
if (e.type === 'pointerdown') {
|
|
3037
|
-
if (data.pointerId !== null && data.pointerId !== e.pointerId)
|
|
3038
|
-
return;
|
|
3039
|
-
}
|
|
2781
|
+
if (data.pointerId !== null && data.pointerId !== e.pointerId) return;
|
|
3040
2782
|
data.pointerId = e.pointerId;
|
|
3041
2783
|
} else if (e.type === 'touchstart' && e.targetTouches.length === 1) {
|
|
3042
2784
|
data.touchId = e.targetTouches[0].identifier;
|
|
@@ -3053,9 +2795,7 @@ var Swiper = (function () {
|
|
|
3053
2795
|
} = swiper;
|
|
3054
2796
|
if (!enabled) return;
|
|
3055
2797
|
if (!params.simulateTouch && e.pointerType === 'mouse') return;
|
|
3056
|
-
if (swiper.animating && params.preventInteractionOnTransition)
|
|
3057
|
-
return;
|
|
3058
|
-
}
|
|
2798
|
+
if (swiper.animating && params.preventInteractionOnTransition) return;
|
|
3059
2799
|
if (!swiper.animating && params.cssMode && params.loop) {
|
|
3060
2800
|
swiper.loopFix();
|
|
3061
2801
|
}
|
|
@@ -3066,8 +2806,6 @@ var Swiper = (function () {
|
|
|
3066
2806
|
if ('which' in e && e.which === 3) return;
|
|
3067
2807
|
if ('button' in e && e.button > 0) return;
|
|
3068
2808
|
if (data.isTouched && data.isMoved) return;
|
|
3069
|
-
|
|
3070
|
-
// change target el for shadow root component
|
|
3071
2809
|
const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== '';
|
|
3072
2810
|
// eslint-disable-next-line
|
|
3073
2811
|
const eventPath = e.composedPath ? e.composedPath() : e.path;
|
|
@@ -3076,8 +2814,6 @@ var Swiper = (function () {
|
|
|
3076
2814
|
}
|
|
3077
2815
|
const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`;
|
|
3078
2816
|
const isTargetShadow = !!(e.target && e.target.shadowRoot);
|
|
3079
|
-
|
|
3080
|
-
// use closestElement for shadow root element to get the actual closest for nested shadow root element
|
|
3081
2817
|
if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, targetEl) : targetEl.closest(noSwipingSelector))) {
|
|
3082
2818
|
swiper.allowClick = true;
|
|
3083
2819
|
return;
|
|
@@ -3089,12 +2825,7 @@ var Swiper = (function () {
|
|
|
3089
2825
|
touches.currentY = e.pageY;
|
|
3090
2826
|
const startX = touches.currentX;
|
|
3091
2827
|
const startY = touches.currentY;
|
|
3092
|
-
|
|
3093
|
-
// Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore
|
|
3094
|
-
|
|
3095
|
-
if (!preventEdgeSwipe(swiper, e, startX)) {
|
|
3096
|
-
return;
|
|
3097
|
-
}
|
|
2828
|
+
if (!preventEdgeSwipe(swiper, e, startX)) return;
|
|
3098
2829
|
Object.assign(data, {
|
|
3099
2830
|
isTouched: true,
|
|
3100
2831
|
isMoved: false,
|
|
@@ -3123,9 +2854,6 @@ var Swiper = (function () {
|
|
|
3123
2854
|
if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !targetEl.isContentEditable) {
|
|
3124
2855
|
e.preventDefault();
|
|
3125
2856
|
}
|
|
3126
|
-
if (params.freeMode && params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) {
|
|
3127
|
-
swiper.freeMode.onTouchStart();
|
|
3128
|
-
}
|
|
3129
2857
|
swiper.emit('touchStart', e);
|
|
3130
2858
|
}
|
|
3131
2859
|
|
|
@@ -3144,7 +2872,7 @@ var Swiper = (function () {
|
|
|
3144
2872
|
let e = event;
|
|
3145
2873
|
if (e.originalEvent) e = e.originalEvent;
|
|
3146
2874
|
if (e.type === 'pointermove') {
|
|
3147
|
-
if (data.touchId !== null) return;
|
|
2875
|
+
if (data.touchId !== null) return;
|
|
3148
2876
|
const id = e.pointerId;
|
|
3149
2877
|
if (id !== data.pointerId) return;
|
|
3150
2878
|
}
|
|
@@ -3185,7 +2913,6 @@ var Swiper = (function () {
|
|
|
3185
2913
|
}
|
|
3186
2914
|
if (params.touchReleaseOnEdges && !params.loop) {
|
|
3187
2915
|
if (swiper.isVertical()) {
|
|
3188
|
-
// Vertical
|
|
3189
2916
|
if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) {
|
|
3190
2917
|
data.isTouched = false;
|
|
3191
2918
|
data.isMoved = false;
|
|
@@ -3287,7 +3014,6 @@ var Swiper = (function () {
|
|
|
3287
3014
|
swiper.wrapperEl.dispatchEvent(evt);
|
|
3288
3015
|
}
|
|
3289
3016
|
data.allowMomentumBounce = false;
|
|
3290
|
-
// Grab Cursor
|
|
3291
3017
|
if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
|
|
3292
3018
|
swiper.setGrabCursor(true);
|
|
3293
3019
|
}
|
|
@@ -3358,8 +3084,6 @@ var Swiper = (function () {
|
|
|
3358
3084
|
if (!swiper.allowSlidePrev && !swiper.allowSlideNext) {
|
|
3359
3085
|
data.currentTranslate = data.startTranslate;
|
|
3360
3086
|
}
|
|
3361
|
-
|
|
3362
|
-
// Threshold
|
|
3363
3087
|
if (params.threshold > 0) {
|
|
3364
3088
|
if (Math.abs(diff) > params.threshold || data.allowThresholdMove) {
|
|
3365
3089
|
if (!data.allowThresholdMove) {
|
|
@@ -3377,17 +3101,12 @@ var Swiper = (function () {
|
|
|
3377
3101
|
}
|
|
3378
3102
|
if (!params.followFinger || params.cssMode) return;
|
|
3379
3103
|
|
|
3380
|
-
//
|
|
3381
|
-
if (params.
|
|
3104
|
+
// core-lite: no optional feature updates; only watchSlidesProgress
|
|
3105
|
+
if (params.watchSlidesProgress) {
|
|
3382
3106
|
swiper.updateActiveIndex();
|
|
3383
3107
|
swiper.updateSlidesClasses();
|
|
3384
3108
|
}
|
|
3385
|
-
if (params.freeMode && params.freeMode.enabled && swiper.freeMode) {
|
|
3386
|
-
swiper.freeMode.onTouchMove();
|
|
3387
|
-
}
|
|
3388
|
-
// Update progress
|
|
3389
3109
|
swiper.updateProgress(data.currentTranslate);
|
|
3390
|
-
// Update translate
|
|
3391
3110
|
swiper.setTranslate(data.currentTranslate);
|
|
3392
3111
|
}
|
|
3393
3112
|
|
|
@@ -3399,7 +3118,7 @@ var Swiper = (function () {
|
|
|
3399
3118
|
let targetTouch;
|
|
3400
3119
|
const isTouchEvent = e.type === 'touchend' || e.type === 'touchcancel';
|
|
3401
3120
|
if (!isTouchEvent) {
|
|
3402
|
-
if (data.touchId !== null) return;
|
|
3121
|
+
if (data.touchId !== null) return;
|
|
3403
3122
|
if (e.pointerId !== data.pointerId) return;
|
|
3404
3123
|
targetTouch = e;
|
|
3405
3124
|
} else {
|
|
@@ -3408,9 +3127,7 @@ var Swiper = (function () {
|
|
|
3408
3127
|
}
|
|
3409
3128
|
if (['pointercancel', 'pointerout', 'pointerleave', 'contextmenu'].includes(e.type)) {
|
|
3410
3129
|
const proceed = ['pointercancel', 'contextmenu'].includes(e.type) && (swiper.browser.isSafari || swiper.browser.isWebView);
|
|
3411
|
-
if (!proceed)
|
|
3412
|
-
return;
|
|
3413
|
-
}
|
|
3130
|
+
if (!proceed) return;
|
|
3414
3131
|
}
|
|
3415
3132
|
data.pointerId = null;
|
|
3416
3133
|
data.touchId = null;
|
|
@@ -3428,9 +3145,7 @@ var Swiper = (function () {
|
|
|
3428
3145
|
}
|
|
3429
3146
|
data.allowTouchCallbacks = false;
|
|
3430
3147
|
if (!data.isTouched) {
|
|
3431
|
-
if (data.isMoved && params.grabCursor)
|
|
3432
|
-
swiper.setGrabCursor(false);
|
|
3433
|
-
}
|
|
3148
|
+
if (data.isMoved && params.grabCursor) swiper.setGrabCursor(false);
|
|
3434
3149
|
data.isMoved = false;
|
|
3435
3150
|
data.startMoving = false;
|
|
3436
3151
|
return;
|
|
@@ -3440,8 +3155,6 @@ var Swiper = (function () {
|
|
|
3440
3155
|
if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) {
|
|
3441
3156
|
swiper.setGrabCursor(false);
|
|
3442
3157
|
}
|
|
3443
|
-
|
|
3444
|
-
// Time diff
|
|
3445
3158
|
const touchEndTime = now();
|
|
3446
3159
|
const timeDiff = touchEndTime - data.touchStartTime;
|
|
3447
3160
|
|
|
@@ -3468,20 +3181,8 @@ var Swiper = (function () {
|
|
|
3468
3181
|
data.isMoved = false;
|
|
3469
3182
|
data.startMoving = false;
|
|
3470
3183
|
let currentPos;
|
|
3471
|
-
if (params.followFinger)
|
|
3472
|
-
|
|
3473
|
-
} else {
|
|
3474
|
-
currentPos = -data.currentTranslate;
|
|
3475
|
-
}
|
|
3476
|
-
if (params.cssMode) {
|
|
3477
|
-
return;
|
|
3478
|
-
}
|
|
3479
|
-
if (params.freeMode && params.freeMode.enabled) {
|
|
3480
|
-
swiper.freeMode.onTouchEnd({
|
|
3481
|
-
currentPos
|
|
3482
|
-
});
|
|
3483
|
-
return;
|
|
3484
|
-
}
|
|
3184
|
+
if (params.followFinger) currentPos = rtl ? swiper.translate : -swiper.translate;else currentPos = -data.currentTranslate;
|
|
3185
|
+
if (params.cssMode) return;
|
|
3485
3186
|
|
|
3486
3187
|
// Find current slide
|
|
3487
3188
|
const swipeToLast = currentPos >= -swiper.maxTranslate() && !swiper.params.loop;
|
|
@@ -3503,22 +3204,22 @@ var Swiper = (function () {
|
|
|
3503
3204
|
let rewindLastIndex = null;
|
|
3504
3205
|
if (params.rewind) {
|
|
3505
3206
|
if (swiper.isBeginning) {
|
|
3506
|
-
rewindLastIndex =
|
|
3207
|
+
rewindLastIndex = swiper.slides.length - 1;
|
|
3507
3208
|
} else if (swiper.isEnd) {
|
|
3508
3209
|
rewindFirstIndex = 0;
|
|
3509
3210
|
}
|
|
3510
3211
|
}
|
|
3511
|
-
// Find current slide size
|
|
3512
3212
|
const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize;
|
|
3513
3213
|
const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup;
|
|
3514
3214
|
if (timeDiff > params.longSwipesMs) {
|
|
3515
|
-
// Long touches
|
|
3516
3215
|
if (!params.longSwipes) {
|
|
3517
3216
|
swiper.slideTo(swiper.activeIndex);
|
|
3518
3217
|
return;
|
|
3519
3218
|
}
|
|
3520
3219
|
if (swiper.swipeDirection === 'next') {
|
|
3521
|
-
if (ratio >= params.longSwipesRatio)
|
|
3220
|
+
if (ratio >= params.longSwipesRatio) {
|
|
3221
|
+
swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment);
|
|
3222
|
+
} else swiper.slideTo(stopIndex);
|
|
3522
3223
|
}
|
|
3523
3224
|
if (swiper.swipeDirection === 'prev') {
|
|
3524
3225
|
if (ratio > 1 - params.longSwipesRatio) {
|
|
@@ -3570,7 +3271,6 @@ var Swiper = (function () {
|
|
|
3570
3271
|
allowSlidePrev,
|
|
3571
3272
|
snapGrid
|
|
3572
3273
|
} = swiper;
|
|
3573
|
-
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
|
|
3574
3274
|
|
|
3575
3275
|
// Disable locks on resize
|
|
3576
3276
|
swiper.allowSlideNext = true;
|
|
@@ -3578,15 +3278,12 @@ var Swiper = (function () {
|
|
|
3578
3278
|
swiper.updateSize();
|
|
3579
3279
|
swiper.updateSlides();
|
|
3580
3280
|
swiper.updateSlidesClasses();
|
|
3581
|
-
|
|
3582
|
-
if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides && !isVirtualLoop) {
|
|
3281
|
+
if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides) {
|
|
3583
3282
|
swiper.slideTo(swiper.slides.length - 1, 0, false, true);
|
|
3283
|
+
} else if (swiper.params.loop) {
|
|
3284
|
+
swiper.slideToLoop(swiper.realIndex, 0, false, true);
|
|
3584
3285
|
} else {
|
|
3585
|
-
|
|
3586
|
-
swiper.slideToLoop(swiper.realIndex, 0, false, true);
|
|
3587
|
-
} else {
|
|
3588
|
-
swiper.slideTo(swiper.activeIndex, 0, false, true);
|
|
3589
|
-
}
|
|
3286
|
+
swiper.slideTo(swiper.activeIndex, 0, false, true);
|
|
3590
3287
|
}
|
|
3591
3288
|
if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
|
|
3592
3289
|
clearTimeout(swiper.autoplay.resizeTimeout);
|
|
@@ -3596,10 +3293,11 @@ var Swiper = (function () {
|
|
|
3596
3293
|
}
|
|
3597
3294
|
}, 500);
|
|
3598
3295
|
}
|
|
3296
|
+
|
|
3599
3297
|
// Return locks after resize
|
|
3600
3298
|
swiper.allowSlidePrev = allowSlidePrev;
|
|
3601
3299
|
swiper.allowSlideNext = allowSlideNext;
|
|
3602
|
-
if (
|
|
3300
|
+
if (params.watchOverflow && snapGrid !== swiper.snapGrid) {
|
|
3603
3301
|
swiper.checkOverflow();
|
|
3604
3302
|
}
|
|
3605
3303
|
}
|
|
@@ -3768,8 +3466,15 @@ var Swiper = (function () {
|
|
|
3768
3466
|
detachEvents
|
|
3769
3467
|
};
|
|
3770
3468
|
|
|
3771
|
-
const
|
|
3772
|
-
|
|
3469
|
+
const toggleModule = (swiper, params, breakpointParams, prop) => {
|
|
3470
|
+
const wasModuleEnabled = params[prop] && params[prop].enabled;
|
|
3471
|
+
const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled;
|
|
3472
|
+
if (wasModuleEnabled && !isModuleEnabled) {
|
|
3473
|
+
swiper[prop].disable();
|
|
3474
|
+
}
|
|
3475
|
+
if (!wasModuleEnabled && isModuleEnabled) {
|
|
3476
|
+
swiper[prop].enable();
|
|
3477
|
+
}
|
|
3773
3478
|
};
|
|
3774
3479
|
function setBreakpoint() {
|
|
3775
3480
|
const swiper = this;
|
|
@@ -3790,38 +3495,20 @@ var Swiper = (function () {
|
|
|
3790
3495
|
if (!breakpoint || swiper.currentBreakpoint === breakpoint) return;
|
|
3791
3496
|
const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined;
|
|
3792
3497
|
const breakpointParams = breakpointOnlyParams || swiper.originalParams;
|
|
3793
|
-
const wasMultiRow = isGridEnabled(swiper, params);
|
|
3794
|
-
const isMultiRow = isGridEnabled(swiper, breakpointParams);
|
|
3795
3498
|
const wasGrabCursor = swiper.params.grabCursor;
|
|
3796
3499
|
const isGrabCursor = breakpointParams.grabCursor;
|
|
3797
3500
|
const wasEnabled = params.enabled;
|
|
3798
|
-
if (wasMultiRow && !isMultiRow) {
|
|
3799
|
-
el.classList.remove(`${params.containerModifierClass}grid`, `${params.containerModifierClass}grid-column`);
|
|
3800
|
-
swiper.emitContainerClasses();
|
|
3801
|
-
} else if (!wasMultiRow && isMultiRow) {
|
|
3802
|
-
el.classList.add(`${params.containerModifierClass}grid`);
|
|
3803
|
-
if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') {
|
|
3804
|
-
el.classList.add(`${params.containerModifierClass}grid-column`);
|
|
3805
|
-
}
|
|
3806
|
-
swiper.emitContainerClasses();
|
|
3807
|
-
}
|
|
3808
3501
|
if (wasGrabCursor && !isGrabCursor) {
|
|
3809
3502
|
swiper.unsetGrabCursor();
|
|
3810
3503
|
} else if (!wasGrabCursor && isGrabCursor) {
|
|
3811
3504
|
swiper.setGrabCursor();
|
|
3812
3505
|
}
|
|
3813
3506
|
|
|
3814
|
-
//
|
|
3815
|
-
['navigation', 'pagination'
|
|
3507
|
+
// Core-lite: toggle navigation & pagination only.
|
|
3508
|
+
const modules = ['navigation', 'pagination'];
|
|
3509
|
+
modules.forEach(prop => {
|
|
3816
3510
|
if (typeof breakpointParams[prop] === 'undefined') return;
|
|
3817
|
-
|
|
3818
|
-
const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled;
|
|
3819
|
-
if (wasModuleEnabled && !isModuleEnabled) {
|
|
3820
|
-
swiper[prop].disable();
|
|
3821
|
-
}
|
|
3822
|
-
if (!wasModuleEnabled && isModuleEnabled) {
|
|
3823
|
-
swiper[prop].enable();
|
|
3824
|
-
}
|
|
3511
|
+
toggleModule(swiper, params, breakpointParams, prop);
|
|
3825
3512
|
});
|
|
3826
3513
|
const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction;
|
|
3827
3514
|
const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged);
|
|
@@ -3903,7 +3590,7 @@ var Swiper = (function () {
|
|
|
3903
3590
|
getBreakpoint
|
|
3904
3591
|
};
|
|
3905
3592
|
|
|
3906
|
-
|
|
3593
|
+
const prepareClasses = (entries, prefix) => {
|
|
3907
3594
|
const resultClasses = [];
|
|
3908
3595
|
entries.forEach(item => {
|
|
3909
3596
|
if (typeof item === 'object') {
|
|
@@ -3917,7 +3604,7 @@ var Swiper = (function () {
|
|
|
3917
3604
|
}
|
|
3918
3605
|
});
|
|
3919
3606
|
return resultClasses;
|
|
3920
|
-
}
|
|
3607
|
+
};
|
|
3921
3608
|
function addClasses() {
|
|
3922
3609
|
const swiper = this;
|
|
3923
3610
|
const {
|
|
@@ -3927,17 +3614,12 @@ var Swiper = (function () {
|
|
|
3927
3614
|
el,
|
|
3928
3615
|
device
|
|
3929
3616
|
} = swiper;
|
|
3617
|
+
// core-lite: removed module-specific classes
|
|
3930
3618
|
// prettier-ignore
|
|
3931
3619
|
const suffixes = prepareClasses(['initialized', params.direction, {
|
|
3932
|
-
'free-mode': swiper.params.freeMode && params.freeMode.enabled
|
|
3933
|
-
}, {
|
|
3934
3620
|
'autoheight': params.autoHeight
|
|
3935
3621
|
}, {
|
|
3936
3622
|
'rtl': rtl
|
|
3937
|
-
}, {
|
|
3938
|
-
'grid': params.grid && params.grid.rows > 1
|
|
3939
|
-
}, {
|
|
3940
|
-
'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column'
|
|
3941
3623
|
}, {
|
|
3942
3624
|
'android': device.android
|
|
3943
3625
|
}, {
|
|
@@ -4034,16 +3716,12 @@ var Swiper = (function () {
|
|
|
4034
3716
|
autoHeight: false,
|
|
4035
3717
|
// Set wrapper width
|
|
4036
3718
|
setWrapperSize: false,
|
|
4037
|
-
//
|
|
4038
|
-
virtualTranslate: false,
|
|
4039
|
-
// Effects
|
|
3719
|
+
// Effects (core-lite only supports `slide`)
|
|
4040
3720
|
effect: 'slide',
|
|
4041
|
-
// 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
|
|
4042
|
-
|
|
4043
3721
|
// Breakpoints
|
|
4044
3722
|
breakpoints: undefined,
|
|
4045
3723
|
breakpointsBase: 'window',
|
|
4046
|
-
// Slides
|
|
3724
|
+
// Slides
|
|
4047
3725
|
spaceBetween: 0,
|
|
4048
3726
|
slidesPerView: 1,
|
|
4049
3727
|
slidesPerGroup: 1,
|
|
@@ -4146,7 +3824,9 @@ var Swiper = (function () {
|
|
|
4146
3824
|
if (moduleParamName === 'navigation' && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].prevEl && !params[moduleParamName].nextEl) {
|
|
4147
3825
|
params[moduleParamName].auto = true;
|
|
4148
3826
|
}
|
|
4149
|
-
|
|
3827
|
+
|
|
3828
|
+
// Core-lite: keep only pagination auto-init.
|
|
3829
|
+
if (moduleParamName === 'pagination' && params[moduleParamName] && params[moduleParamName].enabled && !params[moduleParamName].el) {
|
|
4150
3830
|
params[moduleParamName].auto = true;
|
|
4151
3831
|
}
|
|
4152
3832
|
if (!(moduleParamName in params && 'enabled' in moduleParams)) {
|
|
@@ -4272,7 +3952,6 @@ var Swiper = (function () {
|
|
|
4272
3952
|
// Indexes
|
|
4273
3953
|
activeIndex: 0,
|
|
4274
3954
|
realIndex: 0,
|
|
4275
|
-
//
|
|
4276
3955
|
isBeginning: true,
|
|
4277
3956
|
isEnd: false,
|
|
4278
3957
|
// Props
|
|
@@ -4299,12 +3978,9 @@ var Swiper = (function () {
|
|
|
4299
3978
|
currentTranslate: undefined,
|
|
4300
3979
|
startTranslate: undefined,
|
|
4301
3980
|
allowThresholdMove: undefined,
|
|
4302
|
-
// Form elements to match
|
|
4303
3981
|
focusableElements: swiper.params.focusableElements,
|
|
4304
|
-
// Last click time
|
|
4305
3982
|
lastClickTime: 0,
|
|
4306
3983
|
clickTimeout: undefined,
|
|
4307
|
-
// Velocities
|
|
4308
3984
|
velocities: [],
|
|
4309
3985
|
allowMomentumBounce: undefined,
|
|
4310
3986
|
startMoving: undefined,
|
|
@@ -4333,7 +4009,6 @@ var Swiper = (function () {
|
|
|
4333
4009
|
swiper.init();
|
|
4334
4010
|
}
|
|
4335
4011
|
|
|
4336
|
-
// Return app instance
|
|
4337
4012
|
// eslint-disable-next-line no-constructor-return
|
|
4338
4013
|
return swiper;
|
|
4339
4014
|
}
|
|
@@ -4365,16 +4040,6 @@ var Swiper = (function () {
|
|
|
4365
4040
|
getSlideIndexByData(index) {
|
|
4366
4041
|
return this.getSlideIndex(this.slides.find(slideEl => slideEl.getAttribute('data-swiper-slide-index') * 1 === index));
|
|
4367
4042
|
}
|
|
4368
|
-
getSlideIndexWhenGrid(index) {
|
|
4369
|
-
if (this.grid && this.params.grid && this.params.grid.rows > 1) {
|
|
4370
|
-
if (this.params.grid.fill === 'column') {
|
|
4371
|
-
index = Math.floor(index / this.params.grid.rows);
|
|
4372
|
-
} else if (this.params.grid.fill === 'row') {
|
|
4373
|
-
index = index % Math.ceil(this.slides.length / this.params.grid.rows);
|
|
4374
|
-
}
|
|
4375
|
-
}
|
|
4376
|
-
return index;
|
|
4377
|
-
}
|
|
4378
4043
|
recalcSlides() {
|
|
4379
4044
|
const swiper = this;
|
|
4380
4045
|
const {
|
|
@@ -4476,21 +4141,15 @@ var Swiper = (function () {
|
|
|
4476
4141
|
}
|
|
4477
4142
|
}
|
|
4478
4143
|
} else {
|
|
4479
|
-
// eslint-disable-next-line
|
|
4480
4144
|
if (view === 'current') {
|
|
4481
4145
|
for (let i = activeIndex + 1; i < slides.length; i += 1) {
|
|
4482
4146
|
const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize;
|
|
4483
|
-
if (slideInView)
|
|
4484
|
-
spv += 1;
|
|
4485
|
-
}
|
|
4147
|
+
if (slideInView) spv += 1;
|
|
4486
4148
|
}
|
|
4487
4149
|
} else {
|
|
4488
|
-
// previous
|
|
4489
4150
|
for (let i = activeIndex - 1; i >= 0; i -= 1) {
|
|
4490
4151
|
const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize;
|
|
4491
|
-
if (slideInView)
|
|
4492
|
-
spv += 1;
|
|
4493
|
-
}
|
|
4152
|
+
if (slideInView) spv += 1;
|
|
4494
4153
|
}
|
|
4495
4154
|
}
|
|
4496
4155
|
}
|
|
@@ -4503,14 +4162,11 @@ var Swiper = (function () {
|
|
|
4503
4162
|
snapGrid,
|
|
4504
4163
|
params
|
|
4505
4164
|
} = swiper;
|
|
4506
|
-
// Breakpoints
|
|
4507
4165
|
if (params.breakpoints) {
|
|
4508
4166
|
swiper.setBreakpoint();
|
|
4509
4167
|
}
|
|
4510
4168
|
[...swiper.el.querySelectorAll('[loading="lazy"]')].forEach(imageEl => {
|
|
4511
|
-
if (imageEl.complete)
|
|
4512
|
-
processLazyPreloader(swiper, imageEl);
|
|
4513
|
-
}
|
|
4169
|
+
if (imageEl.complete) processLazyPreloader(swiper, imageEl);
|
|
4514
4170
|
});
|
|
4515
4171
|
swiper.updateSize();
|
|
4516
4172
|
swiper.updateSlides();
|
|
@@ -4524,22 +4180,12 @@ var Swiper = (function () {
|
|
|
4524
4180
|
swiper.updateSlidesClasses();
|
|
4525
4181
|
}
|
|
4526
4182
|
let translated;
|
|
4527
|
-
if (params.
|
|
4528
|
-
|
|
4529
|
-
if (params.autoHeight) {
|
|
4530
|
-
swiper.updateAutoHeight();
|
|
4531
|
-
}
|
|
4183
|
+
if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !params.centeredSlides) {
|
|
4184
|
+
translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true);
|
|
4532
4185
|
} else {
|
|
4533
|
-
|
|
4534
|
-
const slides = swiper.virtual && params.virtual.enabled ? swiper.virtual.slides : swiper.slides;
|
|
4535
|
-
translated = swiper.slideTo(slides.length - 1, 0, false, true);
|
|
4536
|
-
} else {
|
|
4537
|
-
translated = swiper.slideTo(swiper.activeIndex, 0, false, true);
|
|
4538
|
-
}
|
|
4539
|
-
if (!translated) {
|
|
4540
|
-
setTranslate();
|
|
4541
|
-
}
|
|
4186
|
+
translated = swiper.slideTo(swiper.activeIndex, 0, false, true);
|
|
4542
4187
|
}
|
|
4188
|
+
if (!translated) setTranslate();
|
|
4543
4189
|
if (params.watchOverflow && snapGrid !== swiper.snapGrid) {
|
|
4544
4190
|
swiper.checkOverflow();
|
|
4545
4191
|
}
|
|
@@ -4552,7 +4198,6 @@ var Swiper = (function () {
|
|
|
4552
4198
|
const swiper = this;
|
|
4553
4199
|
const currentDirection = swiper.params.direction;
|
|
4554
4200
|
if (!newDirection) {
|
|
4555
|
-
// eslint-disable-next-line
|
|
4556
4201
|
newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal';
|
|
4557
4202
|
}
|
|
4558
4203
|
if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') {
|
|
@@ -4590,15 +4235,11 @@ var Swiper = (function () {
|
|
|
4590
4235
|
mount(element) {
|
|
4591
4236
|
const swiper = this;
|
|
4592
4237
|
if (swiper.mounted) return true;
|
|
4593
|
-
|
|
4594
|
-
// Find el
|
|
4595
4238
|
let el = element || swiper.params.el;
|
|
4596
4239
|
if (typeof el === 'string') {
|
|
4597
4240
|
el = document.querySelector(el);
|
|
4598
4241
|
}
|
|
4599
|
-
if (!el)
|
|
4600
|
-
return false;
|
|
4601
|
-
}
|
|
4242
|
+
if (!el) return false;
|
|
4602
4243
|
el.swiper = swiper;
|
|
4603
4244
|
if (el.parentNode && el.parentNode.host && el.parentNode.host.nodeName === swiper.params.swiperElementNodeName.toUpperCase()) {
|
|
4604
4245
|
swiper.isElement = true;
|
|
@@ -4609,12 +4250,10 @@ var Swiper = (function () {
|
|
|
4609
4250
|
const getWrapper = () => {
|
|
4610
4251
|
if (el && el.shadowRoot && el.shadowRoot.querySelector) {
|
|
4611
4252
|
const res = el.shadowRoot.querySelector(getWrapperSelector());
|
|
4612
|
-
// Children needs to return slot items
|
|
4613
4253
|
return res;
|
|
4614
4254
|
}
|
|
4615
4255
|
return elementChildren(el, getWrapperSelector())[0];
|
|
4616
4256
|
};
|
|
4617
|
-
// Find Wrapper
|
|
4618
4257
|
let wrapperEl = getWrapper();
|
|
4619
4258
|
if (!wrapperEl && swiper.params.createElements) {
|
|
4620
4259
|
wrapperEl = createElement('div', swiper.params.wrapperClass);
|
|
@@ -4629,7 +4268,6 @@ var Swiper = (function () {
|
|
|
4629
4268
|
slidesEl: swiper.isElement && !el.parentNode.host.slideSlots ? el.parentNode.host : wrapperEl,
|
|
4630
4269
|
hostEl: swiper.isElement ? el.parentNode.host : el,
|
|
4631
4270
|
mounted: true,
|
|
4632
|
-
// RTL
|
|
4633
4271
|
rtl: el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl',
|
|
4634
4272
|
rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || elementStyle(el, 'direction') === 'rtl'),
|
|
4635
4273
|
wrongRTL: elementStyle(wrapperEl, 'display') === '-webkit-box'
|
|
@@ -4649,7 +4287,6 @@ var Swiper = (function () {
|
|
|
4649
4287
|
const gap = Math.abs(swiper.snapGrid[1] - swiper.snapGrid[0]);
|
|
4650
4288
|
const swiperTranslate = structuredClone(swiper.snapGrid[1]);
|
|
4651
4289
|
if (isFirstSlide) {
|
|
4652
|
-
// Move last item to first position when at first slide
|
|
4653
4290
|
const lastSlide = slides.at(-1);
|
|
4654
4291
|
lastSlide.swiperLoopMoveDOM = true;
|
|
4655
4292
|
swiper.slidesEl.prepend(lastSlide);
|
|
@@ -4661,7 +4298,6 @@ var Swiper = (function () {
|
|
|
4661
4298
|
swiper.setTransition(speed);
|
|
4662
4299
|
swiper.setTranslate(-swiperTranslate);
|
|
4663
4300
|
} else if (isLastSlide) {
|
|
4664
|
-
// Move first item to last position when at last slide
|
|
4665
4301
|
const firstSlide = slides[0];
|
|
4666
4302
|
firstSlide.swiperLoopMoveDOM = true;
|
|
4667
4303
|
swiper.slidesEl.append(firstSlide);
|
|
@@ -4682,42 +4318,24 @@ var Swiper = (function () {
|
|
|
4682
4318
|
const mounted = swiper.mount(el);
|
|
4683
4319
|
if (mounted === false) return swiper;
|
|
4684
4320
|
swiper.emit('beforeInit');
|
|
4685
|
-
|
|
4686
|
-
// Set breakpoint
|
|
4687
4321
|
if (swiper.params.breakpoints) {
|
|
4688
4322
|
swiper.setBreakpoint();
|
|
4689
4323
|
}
|
|
4690
|
-
|
|
4691
|
-
// Add Classes
|
|
4692
4324
|
swiper.addClasses();
|
|
4693
|
-
|
|
4694
|
-
// Update size
|
|
4695
4325
|
swiper.updateSize();
|
|
4696
|
-
|
|
4697
|
-
// Update slides
|
|
4698
4326
|
swiper.updateSlides();
|
|
4699
4327
|
if (swiper.params.watchOverflow) {
|
|
4700
4328
|
swiper.checkOverflow();
|
|
4701
4329
|
}
|
|
4702
|
-
|
|
4703
|
-
// Set Grab Cursor
|
|
4704
4330
|
if (swiper.params.grabCursor && swiper.enabled) {
|
|
4705
4331
|
swiper.setGrabCursor();
|
|
4706
4332
|
}
|
|
4707
4333
|
|
|
4708
|
-
// Slide
|
|
4709
|
-
|
|
4710
|
-
swiper.slideTo(swiper.params.initialSlide + swiper.virtual.slidesBefore, 0, swiper.params.runCallbacksOnInit, false, true);
|
|
4711
|
-
} else {
|
|
4712
|
-
swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true);
|
|
4713
|
-
}
|
|
4714
|
-
|
|
4715
|
-
// Create loop
|
|
4334
|
+
// Slide to initial slide (core-lite: no optional feature initial offsets)
|
|
4335
|
+
swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true);
|
|
4716
4336
|
if (swiper.params.loop) {
|
|
4717
4337
|
swiper.loopCreate(undefined, true);
|
|
4718
4338
|
}
|
|
4719
|
-
|
|
4720
|
-
// Attach events
|
|
4721
4339
|
swiper.attachEvents();
|
|
4722
4340
|
const lazyElements = [...swiper.el.querySelectorAll('[loading="lazy"]')];
|
|
4723
4341
|
if (swiper.isElement) {
|
|
@@ -4727,18 +4345,12 @@ var Swiper = (function () {
|
|
|
4727
4345
|
if (imageEl.complete) {
|
|
4728
4346
|
processLazyPreloader(swiper, imageEl);
|
|
4729
4347
|
} else {
|
|
4730
|
-
imageEl.addEventListener('load', e =>
|
|
4731
|
-
processLazyPreloader(swiper, e.target);
|
|
4732
|
-
});
|
|
4348
|
+
imageEl.addEventListener('load', e => processLazyPreloader(swiper, e.target));
|
|
4733
4349
|
}
|
|
4734
4350
|
});
|
|
4735
4351
|
preload(swiper);
|
|
4736
|
-
|
|
4737
|
-
// Init Flag
|
|
4738
4352
|
swiper.initialized = true;
|
|
4739
4353
|
preload(swiper);
|
|
4740
|
-
|
|
4741
|
-
// Emit
|
|
4742
4354
|
swiper.emit('init');
|
|
4743
4355
|
swiper.emit('afterInit');
|
|
4744
4356
|
return swiper;
|
|
@@ -4761,27 +4373,15 @@ var Swiper = (function () {
|
|
|
4761
4373
|
return null;
|
|
4762
4374
|
}
|
|
4763
4375
|
swiper.emit('beforeDestroy');
|
|
4764
|
-
|
|
4765
|
-
// Init Flag
|
|
4766
4376
|
swiper.initialized = false;
|
|
4767
|
-
|
|
4768
|
-
// Detach events
|
|
4769
4377
|
swiper.detachEvents();
|
|
4770
|
-
|
|
4771
|
-
// Destroy loop
|
|
4772
4378
|
if (params.loop) {
|
|
4773
4379
|
swiper.loopDestroy();
|
|
4774
4380
|
}
|
|
4775
|
-
|
|
4776
|
-
// Cleanup styles
|
|
4777
4381
|
if (cleanStyles) {
|
|
4778
4382
|
swiper.removeClasses();
|
|
4779
|
-
if (el && typeof el !== 'string')
|
|
4780
|
-
|
|
4781
|
-
}
|
|
4782
|
-
if (wrapperEl) {
|
|
4783
|
-
wrapperEl.removeAttribute('style');
|
|
4784
|
-
}
|
|
4383
|
+
if (el && typeof el !== 'string') el.removeAttribute('style');
|
|
4384
|
+
if (wrapperEl) wrapperEl.removeAttribute('style');
|
|
4785
4385
|
if (slides && slides.length) {
|
|
4786
4386
|
slides.forEach(slideEl => {
|
|
4787
4387
|
slideEl.classList.remove(params.slideVisibleClass, params.slideFullyVisibleClass, params.slideActiveClass, params.slideNextClass, params.slidePrevClass);
|
|
@@ -4791,8 +4391,6 @@ var Swiper = (function () {
|
|
|
4791
4391
|
}
|
|
4792
4392
|
}
|
|
4793
4393
|
swiper.emit('destroy');
|
|
4794
|
-
|
|
4795
|
-
// Detach emitter events
|
|
4796
4394
|
Object.keys(swiper.eventsListeners).forEach(eventName => {
|
|
4797
4395
|
swiper.off(eventName);
|
|
4798
4396
|
});
|
|
@@ -10227,7 +9825,7 @@ var Swiper = (function () {
|
|
|
10227
9825
|
}
|
|
10228
9826
|
|
|
10229
9827
|
/**
|
|
10230
|
-
* Swiper 0.0.
|
|
9828
|
+
* Swiper 0.0.15-dev.1
|
|
10231
9829
|
* Gem SDK - Swiper, Customized of swiper
|
|
10232
9830
|
* https://swiperjs.com
|
|
10233
9831
|
*
|
|
@@ -10235,7 +9833,7 @@ var Swiper = (function () {
|
|
|
10235
9833
|
*
|
|
10236
9834
|
* Released under the MIT License
|
|
10237
9835
|
*
|
|
10238
|
-
* Released on: March
|
|
9836
|
+
* Released on: March 20, 2026
|
|
10239
9837
|
*/
|
|
10240
9838
|
|
|
10241
9839
|
|