1 | function checkOverflow() {
|
2 | const swiper = this;
|
3 | const {
|
4 | isLocked: wasLocked,
|
5 | params
|
6 | } = swiper;
|
7 | const {
|
8 | slidesOffsetBefore
|
9 | } = params;
|
10 |
|
11 | if (slidesOffsetBefore) {
|
12 | const lastSlideIndex = swiper.slides.length - 1;
|
13 | const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2;
|
14 | swiper.isLocked = swiper.size > lastSlideRightEdge;
|
15 | } else {
|
16 | swiper.isLocked = swiper.snapGrid.length === 1;
|
17 | }
|
18 |
|
19 | if (params.allowSlideNext === true) {
|
20 | swiper.allowSlideNext = !swiper.isLocked;
|
21 | }
|
22 |
|
23 | if (params.allowSlidePrev === true) {
|
24 | swiper.allowSlidePrev = !swiper.isLocked;
|
25 | }
|
26 |
|
27 | if (wasLocked && wasLocked !== swiper.isLocked) {
|
28 | swiper.isEnd = false;
|
29 | }
|
30 |
|
31 | if (wasLocked !== swiper.isLocked) {
|
32 | swiper.emit(swiper.isLocked ? 'lock' : 'unlock');
|
33 | }
|
34 | }
|
35 |
|
36 | export default {
|
37 | checkOverflow
|
38 | }; |
\ | No newline at end of file |