1 | export default function onResize() {
|
2 | const swiper = this;
|
3 | const {
|
4 | params,
|
5 | el
|
6 | } = swiper;
|
7 | if (el && el.offsetWidth === 0) return;
|
8 |
|
9 | if (params.breakpoints) {
|
10 | swiper.setBreakpoint();
|
11 | }
|
12 |
|
13 |
|
14 | const {
|
15 | allowSlideNext,
|
16 | allowSlidePrev,
|
17 | snapGrid
|
18 | } = swiper;
|
19 |
|
20 | swiper.allowSlideNext = true;
|
21 | swiper.allowSlidePrev = true;
|
22 | swiper.updateSize();
|
23 | swiper.updateSlides();
|
24 | swiper.updateSlidesClasses();
|
25 |
|
26 | if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides) {
|
27 | swiper.slideTo(swiper.slides.length - 1, 0, false, true);
|
28 | } else {
|
29 | swiper.slideTo(swiper.activeIndex, 0, false, true);
|
30 | }
|
31 |
|
32 | if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) {
|
33 | swiper.autoplay.run();
|
34 | }
|
35 |
|
36 |
|
37 | swiper.allowSlidePrev = allowSlidePrev;
|
38 | swiper.allowSlideNext = allowSlideNext;
|
39 |
|
40 | if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) {
|
41 | swiper.checkOverflow();
|
42 | }
|
43 | } |
\ | No newline at end of file |