@@ -110,13 +110,18 @@ const Thumbs = {
110
110
. nextAll ( `[data-swiper-slide-index="${ swiper . realIndex } "]` )
111
111
. eq ( 0 )
112
112
. index ( ) ;
113
- if ( typeof prevThumbsIndex === 'undefined' ) newThumbsIndex = nextThumbsIndex ;
114
- else if ( typeof nextThumbsIndex === 'undefined' ) newThumbsIndex = prevThumbsIndex ;
115
- else if ( nextThumbsIndex - currentThumbsIndex === currentThumbsIndex - prevThumbsIndex )
116
- newThumbsIndex = currentThumbsIndex ;
117
- else if ( nextThumbsIndex - currentThumbsIndex < currentThumbsIndex - prevThumbsIndex )
113
+ if ( typeof prevThumbsIndex === 'undefined' ) {
118
114
newThumbsIndex = nextThumbsIndex ;
119
- else newThumbsIndex = prevThumbsIndex ;
115
+ } else if ( typeof nextThumbsIndex === 'undefined' ) {
116
+ newThumbsIndex = prevThumbsIndex ;
117
+ } else if ( nextThumbsIndex - currentThumbsIndex === currentThumbsIndex - prevThumbsIndex ) {
118
+ newThumbsIndex =
119
+ thumbsSwiper . params . slidesPerGroup > 1 ? nextThumbsIndex : currentThumbsIndex ;
120
+ } else if ( nextThumbsIndex - currentThumbsIndex < currentThumbsIndex - prevThumbsIndex ) {
121
+ newThumbsIndex = nextThumbsIndex ;
122
+ } else {
123
+ newThumbsIndex = prevThumbsIndex ;
124
+ }
120
125
direction = swiper . activeIndex > swiper . previousIndex ? 'next' : 'prev' ;
121
126
} else {
122
127
newThumbsIndex = swiper . realIndex ;
@@ -136,8 +141,11 @@ const Thumbs = {
136
141
} else {
137
142
newThumbsIndex = newThumbsIndex + Math . floor ( slidesPerView / 2 ) - 1 ;
138
143
}
139
- } else if ( newThumbsIndex > currentThumbsIndex ) {
140
- newThumbsIndex = newThumbsIndex - slidesPerView + 1 ;
144
+ } else if (
145
+ newThumbsIndex > currentThumbsIndex &&
146
+ thumbsSwiper . params . slidesPerGroup === 1
147
+ ) {
148
+ // newThumbsIndex = newThumbsIndex - slidesPerView + 1;
141
149
}
142
150
thumbsSwiper . slideTo ( newThumbsIndex , initial ? 0 : undefined ) ;
143
151
}
0 commit comments