File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -56,13 +56,15 @@ export default function setBreakpoint() {
56
56
breakpointParams . direction && breakpointParams . direction !== params . direction ;
57
57
const needsReLoop =
58
58
params . loop && ( breakpointParams . slidesPerView !== params . slidesPerView || directionChanged ) ;
59
+ const wasLoop = params . loop ;
59
60
60
61
if ( directionChanged && initialized ) {
61
62
swiper . changeDirection ( ) ;
62
63
}
63
64
extend ( swiper . params , breakpointParams ) ;
64
65
65
66
const isEnabled = swiper . params . enabled ;
67
+ const hasLoop = swiper . params . loop ;
66
68
67
69
Object . assign ( swiper , {
68
70
allowTouchMove : swiper . params . allowTouchMove ,
@@ -80,10 +82,17 @@ export default function setBreakpoint() {
80
82
81
83
swiper . emit ( '_beforeBreakpoint' , breakpointParams ) ;
82
84
83
- if ( needsReLoop && initialized ) {
84
- swiper . loopDestroy ( ) ;
85
- swiper . loopCreate ( realIndex ) ;
86
- swiper . updateSlides ( ) ;
85
+ if ( initialized ) {
86
+ if ( needsReLoop ) {
87
+ swiper . loopDestroy ( ) ;
88
+ swiper . loopCreate ( realIndex ) ;
89
+ swiper . updateSlides ( ) ;
90
+ } else if ( ! wasLoop && hasLoop ) {
91
+ swiper . loopCreate ( realIndex ) ;
92
+ swiper . updateSlides ( ) ;
93
+ } else if ( wasLoop && ! hasLoop ) {
94
+ swiper . loopDestroy ( ) ;
95
+ }
87
96
}
88
97
89
98
swiper . emit ( 'breakpoint' , breakpointParams ) ;
You can’t perform that action at this time.
0 commit comments