Skip to content

Commit

Permalink
fixed breakpoint with loop getting wrong realIndex when on init
Browse files Browse the repository at this point in the history
  • Loading branch information
Coke Chien committed Apr 18, 2018
1 parent 228df24 commit 24c9185
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/core/breakpoints/setBreakpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import Utils from '../../../utils/utils';

export default function () {
const swiper = this;
const { activeIndex, loopedSlides = 0, params } = swiper;
const {
activeIndex, initialized, loopedSlides = 0, params,
} = swiper;
const breakpoints = params.breakpoints;
if (!breakpoints || (breakpoints && Object.keys(breakpoints).length === 0)) return;
// Set breakpoint for window width and update parameters
Expand All @@ -21,7 +23,7 @@ export default function () {

swiper.currentBreakpoint = breakpoint;

if (needsReLoop) {
if (needsReLoop && initialized) {
swiper.loopDestroy();
swiper.loopCreate();
swiper.updateSlides();
Expand Down

0 comments on commit 24c9185

Please sign in to comment.