PageSourceSearch

https://megashow.co.kr/app/javascript/plugin/touchSlider/swiper.js

js megashow.co.kr collected 2026-10-05 03:20:02 UTC 153,698 bytes, 3,574 lines download raw bytes

1/**
2 * Swiper 3.2.7
3 * Most modern mobile touch slider and framework with hardware accelerated transitions
4 *
5 * http://www.idangero.us/swiper/
6 *
7 * Copyright 2015, Vladimir Kharlampidi
8 * The iDangero.us
9 * http://www.idangero.us/
10 *
11 * Licensed under MIT
12 *
13 * Released on: December 7, 2015
14 */
15(function () {
16    'use strict';
17    var $;
18    /*===========================
19    Swiper
20    ===========================*/
21    var Swiper = function (container, params) {
22        if (!(this instanceof Swiper)) return new Swiper(container, params);
23
24        var defaults = {
25            direction: 'horizontal',
26            touchEventsTarget: 'container',
27            initialSlide: 0,
28            speed: 300,
29            // autoplay
30            autoplay: false,
31            autoplayDisableOnInteraction: true,
32            // To support iOS's swipe-to-go-back gesture (when being used in-app, with UIWebView).
33            iOSEdgeSwipeDetection: false,
34            iOSEdgeSwipeThreshold: 20,
35            // Free mode
36            freeMode: false,
37            freeModeMomentum: true,
38            freeModeMomentumRatio: 1,
39            freeModeMomentumBounce: true,
40            freeModeMomentumBounceRatio: 1,
41            freeModeSticky: false,
42            freeModeMinimumVelocity: 0.02,
43            // Autoheight
44            autoHeight: false,
45            // Set wrapper width
46            setWrapperSize: false,
47            // Virtual Translate
48            virtualTranslate: false,
49            // Effects
50            effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow'
51            coverflow: {
52                rotate: 50,
53                stretch: 0,
54                depth: 100,
55                modifier: 1,
56                slideShadows : true
57            },
58            cube: {
59                slideShadows: true,
60                shadow: true,
61                shadowOffset: 20,
62                shadowScale: 0.94
63            },
64            fade: {
65                crossFade: false
66            },
67            // Parallax
68            parallax: false,
69            // Scrollbar
70            scrollbar: null,
71            scrollbarHide: true,
72            scrollbarDraggable: false,
73            scrollbarSnapOnRelease: false,
74            // Keyboard Mousewheel
75            keyboardControl: false,
76            mousewheelControl: false,
77            mousewheelReleaseOnEdges: false,
78            mousewheelInvert: false,
79            mousewheelForceToAxis: false,
80            mousewheelSensitivity: 1,
81            // Hash Navigation
82            hashnav: false,
83            // Breakpoints
84            breakpoints: undefined,
85            // Slides grid
86            spaceBetween: 0,
87            slidesPerView: 1,
88            slidesPerColumn: 1,
89            slidesPerColumnFill: 'column',
90            slidesPerGroup: 1,
91            centeredSlides: false,
92            slidesOffsetBefore: 0, // in px
93            slidesOffsetAfter: 0, // in px
94            // Round length
95            roundLengths: false,
96            // Touches
97            touchRatio: 1,
98            touchAngle: 45,
99            simulateTouch: true,
100            shortSwipes: true,
101            longSwipes: true,
102            longSwipesRatio: 0.5,
103            longSwipesMs: 300,
104            followFinger: true,
105            onlyExternal: false,
106            threshold: 0,
107            touchMoveStopPropagation: true,
108            // Pagination
109            pagination: null,
110            paginationElement: 'span',
111            paginationClickable: false,
112            paginationHide: false,
113            paginationBulletRender: null,
114            // Resistance
115            resistance: true,
116            resistanceRatio: 0.85,
117            // Next/prev buttons
118            nextButton: null,
119            prevButton: null,
120            // Progress
121            watchSlidesProgress: false,
122            watchSlidesVisibility: false,
123            // Cursor
124            grabCursor: false,
125            // Clicks
126            preventClicks: true,
127            preventClicksPropagation: true,
128            slideToClickedSlide: false,
129            // Lazy Loading
130            lazyLoading: false,
131            lazyLoadingInPrevNext: false,
132            lazyLoadingOnTransitionStart: false,
133            // Images
134            preloadImages: true,
135            updateOnImagesReady: true,
136            // loop
137            loop: false,
138            loopAdditionalSlides: 0,
139            loopedSlides: null,
140            // Control
141            control: undefined,
142            controlInverse: false,
143            controlBy: 'slide', //or 'container'
144            // Swiping/no swiping
145            allowSwipeToPrev: true,
146            allowSwipeToNext: true,
147            swipeHandler: null, //'.swipe-handler',
148            noSwiping: true,
149            noSwipingClass: 'swiper-no-swiping',
150            // NS
151            slideClass: 'swiper-slide',
152            slideActiveClass: 'swiper-slide-active',
153            slideVisibleClass: 'swiper-slide-visible',
154            slideDuplicateClass: 'swiper-slide-duplicate',
155            slideNextClass: 'swiper-slide-next',
156            slidePrevClass: 'swiper-slide-prev',
157            wrapperClass: 'swiper-wrapper',
158            bulletClass: 'swiper-pagination-bullet',
159            bulletActiveClass: 'swiper-pagination-bullet-active',
160            buttonDisabledClass: 'swiper-button-disabled',
161            paginationHiddenClass: 'swiper-pagination-hidden',
162            // Observer
163            observer: false,
164            observeParents: false,
165            // Accessibility
166            a11y: false,
167            prevSlideMessage: 'Previous slide',
168            nextSlideMessage: 'Next slide',
169            firstSlideMessage: 'This is the first slide',
170            lastSlideMessage: 'This is the last slide',
171            paginationBulletMessage: 'Go to slide {{index}}',
172            // Callbacks
173            runCallbacksOnInit: true
174            /*
175            Callbacks:
176            onInit: function (swiper)
177            onDestroy: function (swiper)
178            onClick: function (swiper, e)
179            onTap: function (swiper, e)
180            onDoubleTap: function (swiper, e)
181            onSliderMove: function (swiper, e)
182            onSlideChangeStart: function (swiper)
183            onSlideChangeEnd: function (swiper)
184            onTransitionStart: function (swiper)
185            onTransitionEnd: function (swiper)
186            onImagesReady: function (swiper)
187            onProgress: function (swiper, progress)
188            onTouchStart: function (swiper, e)
189            onTouchMove: function (swiper, e)
190            onTouchMoveOpposite: function (swiper, e)
191            onTouchEnd: function (swiper, e)
192            onReachBeginning: function (swiper)
193            onReachEnd: function (swiper)
194            onSetTransition: function (swiper, duration)
195            onSetTranslate: function (swiper, translate)
196            onAutoplayStart: function (swiper)
197            onAutoplayStop: function (swiper),
198            onLazyImageLoad: function (swiper, slide, image)
199            onLazyImageReady: function (swiper, slide, image)
200            */
201
202        };
203        var initialVirtualTranslate = params && params.virtualTranslate;
204
205        params = params || {};
206        var originalParams = {};
207        for (var param in params) {
208            if (typeof params[param] === 'object' && !(params[param].nodeType || params[param] === window || params[param] === document || (typeof Dom7 !== 'undefined' && params[param] instanceof Dom7) || (typeof jQuery !== 'undefined' && params[param] instanceof jQuery))) {
209                originalParams[param] = {};
210                for (var deepParam in params[param]) {
211                    originalParams[param][deepParam] = params[param][deepParam];
212                }
213            }
214            else {
215                originalParams[param] = params[param];
216            }
217        }
218        for (var def in defaults) {
219            if (typeof params[def] === 'undefined') {
220                params[def] = defaults[def];
221            }
222            else if (typeof params[def] === 'object') {
223                for (var deepDef in defaults[def]) {
224                    if (typeof params[def][deepDef] === 'undefined') {
225                        params[def][deepDef] = defaults[def][deepDef];
226                    }
227                }
228            }
229        }
230
231        // Swiper
232        var s = this;
233
234        // Params
235        s.params = params;
236        s.originalParams = originalParams;
237
238        // Classname
239        s.classNames = [];
240        /*=========================
241          Dom Library and plugins
242          ===========================*/
243        if (typeof $ !== 'undefined' && typeof Dom7 !== 'undefined'){
244            $ = Dom7;
245        }
246        if (typeof $ === 'undefined') {
247            if (typeof Dom7 === 'undefined') {
248                $ = window.Dom7 || window.Zepto || window.jQuery;
249            }
250            else {
251                $ = Dom7;
252            }
253            if (!$) return;
254        }
255        // Export it to Swiper instance
256        s.$ = $;
257
258        /*=========================
259          Breakpoints
260          ===========================*/
261        s.currentBreakpoint = undefined;
262        s.getActiveBreakpoint = function () {
263            //Get breakpoint for window width
264            if (!s.params.breakpoints) return false;
265            var breakpoint = false;
266            var points = [], point;
267            for ( point in s.params.breakpoints ) {
268                if (s.params.breakpoints.hasOwnProperty(point)) {
269                    points.push(point);
270                }
271            }
272            points.sort(function (a, b) {
273                return parseInt(a, 10) > parseInt(b, 10);
274            });
275            for (var i = 0; i < points.length; i++) {
276                point = points[i];
277                if (point >= window.innerWidth && !breakpoint) {
278                    breakpoint = point;
279                }
280            }
281            return breakpoint || 'max';
282        };
283        s.setBreakpoint = function () {
284            //Set breakpoint for window width and update parameters
285            var breakpoint = s.getActiveBreakpoint();
286            if (breakpoint && s.currentBreakpoint !== breakpoint) {
287                var breakPointsParams = breakpoint in s.params.breakpoints ? s.params.breakpoints[breakpoint] : s.originalParams;
288                for ( var param in breakPointsParams ) {
289                    s.params[param] = breakPointsParams[param];
290                }
291                s.currentBreakpoint = breakpoint;
292            }
293        };
294        // Set breakpoint on load
295        if (s.params.breakpoints) {
296            s.setBreakpoint();
297        }
298
299        /*=========================
300          Preparation - Define Container, Wrapper and Pagination
301          ===========================*/
302		s.container = $(container);
303        if (s.container.length === 0) {
304			s.container = container;
305		}
306
307        if (s.container.length === 0) return;
308        if (s.container.length > 1) {
309            s.container.each(function () {
310                new Swiper(this, params);
311            });
312            return;
313        }
314
315        // Save instance in container HTML Element and in data
316        s.container[0].swiper = s;
317        s.container.data('swiper', s);
318
319        s.classNames.push('swiper-container-' + s.params.direction);
320
321        if (s.params.freeMode) {
322            s.classNames.push('swiper-container-free-mode');
323        }
324        if (!s.support.flexbox) {
325            s.classNames.push('swiper-container-no-flexbox');
326            s.params.slidesPerColumn = 1;
327        }
328        if (s.params.autoHeight) {
329            s.classNames.push('swiper-container-autoheight');
330        }
331        // Enable slides progress when required
332        if (s.params.parallax || s.params.watchSlidesVisibility) {
333            s.params.watchSlidesProgress = true;
334        }
335        // Coverflow / 3D
336        if (['cube', 'coverflow'].indexOf(s.params.effect) >= 0) {
337            if (s.support.transforms3d) {
338                s.params.watchSlidesProgress = true;
339                s.classNames.push('swiper-container-3d');
340            }
341            else {
342                s.params.effect = 'slide';
343            }
344        }
345        if (s.params.effect !== 'slide') {
346            s.classNames.push('swiper-container-' + s.params.effect);
347        }
348        if (s.params.effect === 'cube') {
349            s.params.resistanceRatio = 0;
350            s.params.slidesPerView = 1;
351            s.params.slidesPerColumn = 1;
352            s.params.slidesPerGroup = 1;
353            s.params.centeredSlides = false;
354            s.params.spaceBetween = 0;
355            s.params.virtualTranslate = true;
356            s.params.setWrapperSize = false;
357        }
358        if (s.params.effect === 'fade') {
359            s.params.slidesPerView = 1;
360            s.params.slidesPerColumn = 1;
361            s.params.slidesPerGroup = 1;
362            s.params.watchSlidesProgress = true;
363            s.params.spaceBetween = 0;
364            if (typeof initialVirtualTranslate === 'undefined') {
365                s.params.virtualTranslate = true;
366            }
367        }
368
369        // Grab Cursor
370        if (s.params.grabCursor && s.support.touch) {
371            s.params.grabCursor = false;
372        }
373
374        // Wrapper
375        s.wrapper = s.container.children('.' + s.params.wrapperClass);
376
377        // Pagination
378        if (s.params.pagination) {
379            s.paginationContainer = $(s.params.pagination);
380            if (s.params.paginationClickable) {
381                s.paginationContainer.addClass('swiper-pagination-clickable');
382            }
383        }
384
385        // Is Horizontal
386        function isH() {
387            return s.params.direction === 'horizontal';
388        }
389
390        // RTL
391        s.rtl = isH() && (s.container[0].dir.toLowerCase() === 'rtl' || s.container.css('direction') === 'rtl');
392        if (s.rtl) {
393            s.classNames.push('swiper-container-rtl');
394        }
395
396        // Wrong RTL support
397        if (s.rtl) {
398            s.wrongRTL = s.wrapper.css('display') === '-webkit-box';
399        }
400
401        // Columns
402        if (s.params.slidesPerColumn > 1) {
403            s.classNames.push('swiper-container-multirow');
404        }
405
406        // Check for Android
407        if (s.device.android) {
408            s.classNames.push('swiper-container-android');
409        }
410
411        // Add classes
412        s.container.addClass(s.classNames.join(' '));
413
414        // Translate
415        s.translate = 0;
416
417        // Progress
418        s.progress = 0;
419
420        // Velocity
421        s.velocity = 0;
422
423        /*=========================
424          Locks, unlocks
425          ===========================*/
426        s.lockSwipeToNext = function () {
427            s.params.allowSwipeToNext = false;
428        };
429        s.lockSwipeToPrev = function () {
430            s.params.allowSwipeToPrev = false;
431        };
432        s.lockSwipes = function () {
433            s.params.allowSwipeToNext = s.params.allowSwipeToPrev = false;
434        };
435        s.unlockSwipeToNext = function () {
436            s.params.allowSwipeToNext = true;
437        };
438        s.unlockSwipeToPrev = function () {
439            s.params.allowSwipeToPrev = true;
440        };
441        s.unlockSwipes = function () {
442            s.params.allowSwipeToNext = s.params.allowSwipeToPrev = true;
443        };
444
445        /*=========================
446          Round helper
447          ===========================*/
448        function round(a) {
449            return Math.floor(a);
450        }
451        /*=========================
452          Set grab cursor
453          ===========================*/
454        if (s.params.grabCursor) {
455            s.container[0].style.cursor = 'move';
456            s.container[0].style.cursor = '-webkit-grab';
457            s.container[0].style.cursor = '-moz-grab';
458            s.container[0].style.cursor = 'grab';
459        }
460        /*=========================
461          Update on Images Ready
462          ===========================*/
463        s.imagesToLoad = [];
464        s.imagesLoaded = 0;
465
466        s.loadImage = function (imgElement, src, srcset, checkForComplete, callback) {
467            var image;
468            function onReady () {
469                if (callback) callback();
470            }
471            if (!imgElement.complete || !checkForComplete) {
472                if (src) {
473                    image = new window.Image();
474                    image.onload = onReady;
475                    image.onerror = onReady;
476                    if (srcset) {
477                        image.srcset = srcset;
478                    }
479                    if (src) {
480                        image.src = src;
481                    }
482                } else {
483                    onReady();
484                }
485
486            } else {//image already loaded...
487                onReady();
488            }
489        };
490        s.preloadImages = function () {
491            s.imagesToLoad = s.container.find('img');
492            function _onReady() {
493                if (typeof s === 'undefined' || s === null) return;
494                if (s.imagesLoaded !== undefined) s.imagesLoaded++;
495                if (s.imagesLoaded === s.imagesToLoad.length) {
496                    if (s.params.updateOnImagesReady) s.update();
497                    s.emit('onImagesReady', s);
498                }
499            }
500            for (var i = 0; i < s.imagesToLoad.length; i++) {
501                s.loadImage(s.imagesToLoad[i], (s.imagesToLoad[i].currentSrc || s.imagesToLoad[i].getAttribute('src')), (s.imagesToLoad[i].srcset || s.imagesToLoad[i].getAttribute('srcset')), true, _onReady);
502            }
503        };
504
505        /*=========================
506          Autoplay
507          ===========================*/
508        s.autoplayTimeoutId = undefined;
509        s.autoplaying = false;
510        s.autoplayPaused = false;
511        function autoplay() {
512            s.autoplayTimeoutId = setTimeout(function () {
513                if (s.params.loop) {
514                    s.fixLoop();
515                    s._slideNext();
516                }
517                else {
518                    if (!s.isEnd) {
519                        s._slideNext();
520                    }
521                    else {
522                        if (!params.autoplayStopOnLast) {
523                            s._slideTo(0);
524                        }
525                        else {
526                            s.stopAutoplay();
527                        }
528                    }
529                }
530            }, s.params.autoplay);
531        }
532        s.startAutoplay = function () {
533            if (typeof s.autoplayTimeoutId !== 'undefined') return false;
534            if (!s.params.autoplay) return false;
535            if (s.autoplaying) return false;
536            s.autoplaying = true;
537            s.emit('onAutoplayStart', s);
538            autoplay();
539        };
540        s.stopAutoplay = function (internal) {
541            if (!s.autoplayTimeoutId) return;
542            if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);
543            s.autoplaying = false;
544            s.autoplayTimeoutId = undefined;
545            s.emit('onAutoplayStop', s);
546        };
547        s.pauseAutoplay = function (speed) {
548            if (s.autoplayPaused) return;
549            if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);
550            s.autoplayPaused = true;
551            if (speed === 0) {
552                s.autoplayPaused = false;
553                autoplay();
554            }
555            else {
556                s.wrapper.transitionEnd(function () {
557                    if (!s) return;
558                    s.autoplayPaused = false;
559                    if (!s.autoplaying) {
560                        s.stopAutoplay();
561                    }
562                    else {
563                        autoplay();
564                    }
565                });
566            }
567        };
568        /*=========================
569          Min/Max Translate
570          ===========================*/
571        s.minTranslate = function () {
572            return (-s.snapGrid[0]);
573        };
574        s.maxTranslate = function () {
575            return (-s.snapGrid[s.snapGrid.length - 1]);
576        };
577        /*=========================
578          Slider/slides sizes
579          ===========================*/
580        s.updateAutoHeight = function () {
581            // Update Height
582            var newHeight = s.slides.eq(s.activeIndex)[0].offsetHeight;
583            if (newHeight) s.wrapper.css('height', s.slides.eq(s.activeIndex)[0].offsetHeight + 'px');
584        };
585        s.updateContainerSize = function () {
586            var width, height;
587            if (typeof s.params.width !== 'undefined') {
588                width = s.params.width;
589            }
590            else {
591                width = s.container[0].clientWidth;
592            }
593            if (typeof s.params.height !== 'undefined') {
594                height = s.params.height;
595            }
596            else {
597                height = s.container[0].clientHeight;
598            }
599            if (width === 0 && isH() || height === 0 && !isH()) {
600                return;
601            }
602
603            //Subtract paddings
604            width = width - parseInt(s.container.css('padding-left'), 10) - parseInt(s.container.css('padding-right'), 10);
605            height = height - parseInt(s.container.css('padding-top'), 10) - parseInt(s.container.css('padding-bottom'), 10);
606
607            // Store values
608            s.width = width;
609            s.height = height;
610            s.size = isH() ? s.width : s.height;
611        };
612
613        s.updateSlidesSize = function () {
614            s.slides = s.wrapper.children('.' + s.params.slideClass);
615            s.snapGrid = [];
616            s.slidesGrid = [];
617            s.slidesSizesGrid = [];
618
619            var spaceBetween = s.params.spaceBetween,
620                slidePosition = -s.params.slidesOffsetBefore,
621                i,
622                prevSlideSize = 0,
623                index = 0;
624            if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
625                spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * s.size;
626            }
627
628            s.virtualSize = -spaceBetween;
629            // reset margins
630            if (s.rtl) s.slides.css({marginLeft: '', marginTop: ''});
631            else s.slides.css({marginRight: '', marginBottom: ''});
632
633            var slidesNumberEvenToRows;
634            if (s.params.slidesPerColumn > 1) {
635                if (Math.floor(s.slides.length / s.params.slidesPerColumn) === s.slides.length / s.params.slidesPerColumn) {
636                    slidesNumberEvenToRows = s.slides.length;
637                }
638                else {
639                    slidesNumberEvenToRows = Math.ceil(s.slides.length / s.params.slidesPerColumn) * s.params.slidesPerColumn;
640                }
641                if (s.params.slidesPerView !== 'auto' && s.params.slidesPerColumnFill === 'row') {
642                    slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, s.params.slidesPerView * s.params.slidesPerColumn);
643                }
644            }
645
646            // Calc slides
647            var slideSize;
648            var slidesPerColumn = s.params.slidesPerColumn;
649            var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn;
650            var numFullColumns = slidesPerRow - (s.params.slidesPerColumn * slidesPerRow - s.slides.length);
651            for (i = 0; i < s.slides.length; i++) {
652                slideSize = 0;
653                var slide = s.slides.eq(i);
654                if (s.params.slidesPerColumn > 1) {
655                    // Set slides order
656                    var newSlideOrderIndex;
657                    var column, row;
658                    if (s.params.slidesPerColumnFill === 'column') {
659                        column = Math.floor(i / slidesPerColumn);
660                        row = i - column * slidesPerColumn;
661                        if (column > numFullColumns || (column === numFullColumns && row === slidesPerColumn-1)) {
662                            if (++row >= slidesPerColumn) {
663                                row = 0;
664                                column++;
665                            }
666                        }
667                        newSlideOrderIndex = column + row * slidesNumberEvenToRows / slidesPerColumn;
668                        slide
669                            .css({
670                                '-webkit-box-ordinal-group': newSlideOrderIndex,
671                                '-moz-box-ordinal-group': newSlideOrderIndex,
672                                '-ms-flex-order': newSlideOrderIndex,
673                                '-webkit-order': newSlideOrderIndex,
674                                'order': newSlideOrderIndex
675                            });
676                    }
677                    else {
678                        row = Math.floor(i / slidesPerRow);
679                        column = i - row * slidesPerRow;
680                    }
681                    slide
682                        .css({
683                            'margin-top': (row !== 0 && s.params.spaceBetween) && (s.params.spaceBetween + 'px')
684                        })
685                        .attr('data-swiper-column', column)
686                        .attr('data-swiper-row', row);
687
688                }
689                if (slide.css('display') === 'none') continue;
690                if (s.params.slidesPerView === 'auto') {
691                    slideSize = isH() ? slide.outerWidth(true) : slide.outerHeight(true);
692                    if (s.params.roundLengths) slideSize = round(slideSize);
693                }
694                else {
695                    slideSize = (s.size - (s.params.slidesPerView - 1) * spaceBetween) / s.params.slidesPerView;
696                    if (s.params.roundLengths) slideSize = round(slideSize);
697
698                    if (isH()) {
699                        s.slides[i].style.width = slideSize + 'px';
700                    }
701                    else {
702                        s.slides[i].style.height = slideSize + 'px';
703                    }
704                }
705                s.slides[i].swiperSlideSize = slideSize;
706                s.slidesSizesGrid.push(slideSize);
707
708
709                if (s.params.centeredSlides) {
710                    slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
711                    if (i === 0) slidePosition = slidePosition - s.size / 2 - spaceBetween;
712                    if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
713                    if ((index) % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);
714                    s.slidesGrid.push(slidePosition);
715                }
716                else {
717                    if ((index) % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);
718                    s.slidesGrid.push(slidePosition);
719                    slidePosition = slidePosition + slideSize + spaceBetween;
720                }
721
722                s.virtualSize += slideSize + spaceBetween;
723
724                prevSlideSize = slideSize;
725
726                index ++;
727            }
728            s.virtualSize = Math.max(s.virtualSize, s.size) + s.params.slidesOffsetAfter;
729            var newSlidesGrid;
730
731            if (
732                s.rtl && s.wrongRTL && (s.params.effect === 'slide' || s.params.effect === 'coverflow')) {
733                s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});
734            }
735            if (!s.support.flexbox || s.params.setWrapperSize) {
736                if (isH()) s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});
737                else s.wrapper.css({height: s.virtualSize + s.params.spaceBetween + 'px'});
738            }
739
740            if (s.params.slidesPerColumn > 1) {
741                s.virtualSize = (slideSize + s.params.spaceBetween) * slidesNumber
741EvenToRows;
742                s.virtualSize = Math.ceil(s.virtualSize / s.params.slidesPerColumn) - s.params.spaceBetween;
743                s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});
744                if (s.params.centeredSlides) {
745                    newSlidesGrid = [];
746                    for (i = 0; i < s.snapGrid.length; i++) {
747                        if (s.snapGrid[i] < s.virtualSize + s.snapGrid[0]) newSlidesGrid.push(s.snapGrid[i]);
748                    }
749                    s.snapGrid = newSlidesGrid;
750                }
751            }
752
753            // Remove last grid elements depending on width
754            if (!s.params.centeredSlides) {
755                newSlidesGrid = [];
756                for (i = 0; i < s.snapGrid.length; i++) {
757                    if (s.snapGrid[i] <= s.virtualSize - s.size) {
758                        newSlidesGrid.push(s.snapGrid[i]);
759                    }
760                }
761                s.snapGrid = newSlidesGrid;
762                if (Math.floor(s.virtualSize - s.size) > Math.floor(s.snapGrid[s.snapGrid.length - 1])) {
763                    s.snapGrid.push(s.virtualSize - s.size);
764                }
765            }
766            if (s.snapGrid.length === 0) s.snapGrid = [0];
767
768            if (s.params.spaceBetween !== 0) {
769                if (isH()) {
770                    if (s.rtl) s.slides.css({marginLeft: spaceBetween + 'px'});
771                    else s.slides.css({marginRight: spaceBetween + 'px'});
772                }
773                else s.slides.css({marginBottom: spaceBetween + 'px'});
774            }
775            if (s.params.watchSlidesProgress) {
776                s.updateSlidesOffset();
777            }
778        };
779        s.updateSlidesOffset = function () {
780            for (var i = 0; i < s.slides.length; i++) {
781                s.slides[i].swiperSlideOffset = isH() ? s.slides[i].offsetLeft : s.slides[i].offsetTop;
782            }
783        };
784
785        /*=========================
786          Slider/slides progress
787          ===========================*/
788        s.updateSlidesProgress = function (translate) {
789            if (typeof translate === 'undefined') {
790                translate = s.translate || 0;
791            }
792            if (s.slides.length === 0) return;
793            if (typeof s.slides[0].swiperSlideOffset === 'undefined') s.updateSlidesOffset();
794
795            var offsetCenter = -translate;
796            if (s.rtl) offsetCenter = translate;
797
798            // Visible Slides
799            s.slides.removeClass(s.params.slideVisibleClass);
800            for (var i = 0; i < s.slides.length; i++) {
801                var slide = s.slides[i];
802                var slideProgress = (offsetCenter - slide.swiperSlideOffset) / (slide.swiperSlideSize + s.params.spaceBetween);
803                if (s.params.watchSlidesVisibility) {
804                    var slideBefore = -(offsetCenter - slide.swiperSlideOffset);
805                    var slideAfter = slideBefore + s.slidesSizesGrid[i];
806                    var isVisible =
807                        (slideBefore >= 0 && slideBefore < s.size) ||
808                        (slideAfter > 0 && slideAfter <= s.size) ||
809                        (slideBefore <= 0 && slideAfter >= s.size);
810                    if (isVisible) {
811                        s.slides.eq(i).addClass(s.params.slideVisibleClass);
812                    }
813                }
814                slide.progress = s.rtl ? -slideProgress : slideProgress;
815            }
816        };
817        s.updateProgress = function (translate) {
818            if (typeof translate === 'undefined') {
819                translate = s.translate || 0;
820            }
821            var translatesDiff = s.maxTranslate() - s.minTranslate();
822            var wasBeginning = s.isBeginning;
823            var wasEnd = s.isEnd;
824            if (translatesDiff === 0) {
825                s.progress = 0;
826                s.isBeginning = s.isEnd = true;
827            }
828            else {
829                s.progress = (translate - s.minTranslate()) / (translatesDiff);
830                s.isBeginning = s.progress <= 0;
831                s.isEnd = s.progress >= 1;
832            }
833            if (s.isBeginning && !wasBeginning) s.emit('onReachBeginning', s);
834            if (s.isEnd && !wasEnd) s.emit('onReachEnd', s);
835
836            if (s.params.watchSlidesProgress) s.updateSlidesProgress(translate);
837            s.emit('onProgress', s, s.progress);
838        };
839        s.updateActiveIndex = function () {
840            var translate = s.rtl ? s.translate : -s.translate;
841            var newActiveIndex, i, snapIndex;
842            for (i = 0; i < s.slidesGrid.length; i ++) {
843                if (typeof s.slidesGrid[i + 1] !== 'undefined') {
844                    if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1] - (s.slidesGrid[i + 1] - s.slidesGrid[i]) / 2) {
845                        newActiveIndex = i;
846                    }
847                    else if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1]) {
848                        newActiveIndex = i + 1;
849                    }
850                }
851                else {
852                    if (translate >= s.slidesGrid[i]) {
853                        newActiveIndex = i;
854                    }
855                }
856            }
857            // Normalize slideIndex
858            if (newActiveIndex < 0 || typeof newActiveIndex === 'undefined') newActiveIndex = 0;
859            // for (i = 0; i < s.slidesGrid.length; i++) {
860                // if (- translate >= s.slidesGrid[i]) {
861                    // newActiveIndex = i;
862                // }
863            // }
864            snapIndex = Math.floor(newActiveIndex / s.params.slidesPerGroup);
865            if (snapIndex >= s.snapGrid.length) snapIndex = s.snapGrid.length - 1;
866
867            if (newActiveIndex === s.activeIndex) {
868                return;
869            }
870            s.snapIndex = snapIndex;
871            s.previousIndex = s.activeIndex;
872            s.activeIndex = newActiveIndex;
873            s.updateClasses();
874        };
875
876        /*=========================
877          Classes
878          ===========================*/
879        s.updateClasses = function () {
880            s.slides.removeClass(s.params.slideActiveClass + ' ' + s.params.slideNextClass + ' ' + s.params.slidePrevClass);
881            var activeSlide = s.slides.eq(s.activeIndex);
882            // Active classes
883            activeSlide.addClass(s.params.slideActiveClass);
884            activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);
885            activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);
886
887            // Pagination
888            if (s.bullets && s.bullets.length > 0) {
889                s.bullets.removeClass(s.params.bulletActiveClass);
890                var bulletIndex;
891                if (s.params.loop) {
892                    bulletIndex = Math.ceil(s.activeIndex - s.loopedSlides)/s.params.slidesPerGroup;
893                    if (bulletIndex > s.slides.length - 1 - s.loopedSlides * 2) {
894                        bulletIndex = bulletIndex - (s.slides.length - s.loopedSlides * 2);
895                    }
896                    if (bulletIndex > s.bullets.length - 1) bulletIndex = bulletIndex - s.bullets.length;
897                }
898                else {
899                    if (typeof s.snapIndex !== 'undefined') {
900                        bulletIndex = s.snapIndex;
901                    }
902                    else {
903                        bulletIndex = s.activeIndex || 0;
904                    }
905                }
906                if (s.paginationContainer.length > 1) {
907                    s.bullets.each(function () {
908                        if ($(this).index() === bulletIndex) $(this).addClass(s.params.bulletActiveClass);
909                    });
910                }
911                else {
912                    s.bullets.eq(bulletIndex).addClass(s.params.bulletActiveClass);
913                }
914            }
915
916            // Next/active buttons
917            if (!s.params.loop) {
918                if (s.params.prevButton) {
919                    if (s.isBeginning) {
920                        $(s.params.prevButton).addClass(s.params.buttonDisabledClass);
921                        if (s.params.a11y && s.a11y) s.a11y.disable($(s.params.prevButton));
922                    }
923                    else {
924                        $(s.params.prevButton).removeClass(s.params.buttonDisabledClass);
925                        if (s.params.a11y && s.a11y) s.a11y.enable($(s.params.prevButton));
926                    }
927                }
928                if (s.params.nextButton) {
929                    if (s.isEnd) {
930                        $(s.params.nextButton).addClass(s.params.buttonDisabledClass);
931                        if (s.params.a11y && s.a11y) s.a11y.disable($(s.params.nextButton));
932                    }
933                    else {
934                        $(s.params.nextButton).removeClass(s.params.buttonDisabledClass);
935                        if (s.params.a11y && s.a11y) s.a11y.enable($(s.params.nextButton));
936                    }
937                }
938            }
939        };
940
941        /*=========================
942          Pagination
943          ===========================*/
944        s.updatePagination = function () {
945            if (!s.params.pagination) return;
946            if (s.paginationContainer && s.paginationContainer.length > 0) {
947                var bulletsHTML = '';
948                var numberOfBullets = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;
949                for (var i = 0; i < numberOfBullets; i++) {
950                    if (s.params.paginationBulletRender) {
951                        bulletsHTML += s.params.paginationBulletRender(i, s.params.bulletClass);
952                    }
953                    else {
954                        bulletsHTML += '<' + s.params.paginationElement+' class="' + s.params.bulletClass + '"></' + s.params.paginationElement + '>';
955                    }
956                }
957                s.paginationContainer.html(bulletsHTML);
958                s.bullets = s.paginationContainer.find('.' + s.params.bulletClass);
959                if (s.params.paginationClickable && s.params.a11y && s.a11y) {
960                    s.a11y.initPagination();
961                }
962            }
963        };
964        /*=========================
965          Common update method
966          ===========================*/
967        s.update = function (updateTranslate) {
968            s.updateContainerSize();
969            s.updateSlidesSize();
970            s.updateProgress();
971            s.updatePagination();
972            s.updateClasses();
973            if (s.params.scrollbar && s.scrollbar) {
974                s.scrollbar.set();
975            }
976            function forceSetTranslate() {
977                newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
978                s.setWrapperTranslate(newTranslate);
979                s.updateActiveIndex();
980                s.updateClasses();
981            }
982            if (updateTranslate) {
983                var translated, newTranslate;
984                if (s.controller && s.controller.spline) {
985                    s.controller.spline = undefined;
986                }
987                if (s.params.freeMode) {
988                    forceSetTranslate();
989                    if (s.params.autoHeight) {
990                        s.updateAutoHeight();
991                    }
992                }
993                else {
994                    if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {
995                        translated = s.slideTo(s.slides.length - 1, 0, false, true);
996                    }
997                    else {
998                        translated = s.slideTo(s.activeIndex, 0, false, true);
999                    }
1000                    if (!translated) {
1001                        forceSetTranslate();
1002                    }
1003                }
1004            }
1005            else if (s.params.autoHeight) {
1006                s.updateAutoHeight();
1007            }
1008        };
1009
1010        /*=========================
1011          Resize Handler
1012          ===========================*/
1013        s.onResize = function (forceUpdatePagination) {
1014            //Breakpoints
1015            if (s.params.breakpoints) {
1016                s.setBreakpoint();
1017            }
1018
1019            // Disable locks on resize
1020            var allowSwipeToPrev = s.params.allowSwipeToPrev;
1021            var allowSwipeToNext = s.params.allowSwipeToNext;
1022            s.params.allowSwipeToPrev = s.params.allowSwipeToNext = true;
1023
1024            s.updateContainerSize();
1025            s.updateSlidesSize();
1026            if (s.params.slidesPerView === 'auto' || s.params.freeMode || force
1026UpdatePagination) s.updatePagination();
1027            if (s.params.scrollbar && s.scrollbar) {
1028                s.scrollbar.set();
1029            }
1030            if (s.controller && s.controller.spline) {
1031                s.controller.spline = undefined;
1032            }
1033            if (s.params.freeMode) {
1034                var newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
1035                s.setWrapperTranslate(newTranslate);
1036                s.updateActiveIndex();
1037                s.updateClasses();
1038
1039                if (s.params.autoHeight) {
1040                    s.updateAutoHeight();
1041                }
1042            }
1043            else {
1044                s.updateClasses();
1045                if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {
1046                    s.slideTo(s.slides.length - 1, 0, false, true);
1047                }
1048                else {
1049                    s.slideTo(s.activeIndex, 0, false, true);
1050                }
1051            }
1052            // Return locks after resize
1053            s.params.allowSwipeToPrev = allowSwipeToPrev;
1054            s.params.allowSwipeToNext = allowSwipeToNext;
1055        };
1056
1057        /*=========================
1058          Events
1059          ===========================*/
1060
1061        //Define Touch Events
1062        var desktopEvents = ['mousedown', 'mousemove', 'mouseup'];
1063        if (window.navigator.pointerEnabled) desktopEvents = ['pointerdown', 'pointermove', 'pointerup'];
1064        else if (window.navigator.msPointerEnabled) desktopEvents = ['MSPointerDown', 'MSPointerMove', 'MSPointerUp'];
1065        s.touchEvents = {
1066            start : s.support.touch || !s.params.simulateTouch  ? 'touchstart' : desktopEvents[0],
1067            move : s.support.touch || !s.params.simulateTouch ? 'touchmove' : desktopEvents[1],
1068            end : s.support.touch || !s.params.simulateTouch ? 'touchend' : desktopEvents[2]
1069        };
1070
1071
1072        // WP8 Touch Events Fix
1073        if (window.navigator.pointerEnabled || window.navigator.msPointerEnabled) {
1074            (s.params.touchEventsTarget === 'container' ? s.container : s.wrapper).addClass('swiper-wp8-' + s.params.direction);
1075        }
1076
1077        // Attach/detach events
1078        s.initEvents = function (detach) {
1079            var actionDom = detach ? 'off' : 'on';
1080            var action = detach ? 'removeEventListener' : 'addEventListener';
1081            var touchEventsTarget = s.params.touchEventsTarget === 'container' ? s.container[0] : s.wrapper[0];
1082            var target = s.support.touch ? touchEventsTarget : document;
1083
1084            var moveCapture = s.params.nested ? true : false;
1085
1086            //Touch Events
1087            if (s.browser.ie) {
1088                touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false);
1089                target[action](s.touchEvents.move, s.onTouchMove, moveCapture);
1090                target[action](s.touchEvents.end, s.onTouchEnd, false);
1091            }
1092            else {
1093                if (s.support.touch) {
1094                    touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false);
1095                    touchEventsTarget[action](s.touchEvents.move, s.onTouchMove, moveCapture);
1096                    touchEventsTarget[action](s.touchEvents.end, s.onTouchEnd, false);
1097                }
1098                if (params.simulateTouch && !s.device.ios && !s.device.android) {
1099                    touchEventsTarget[action]('mousedown', s.onTouchStart, false);
1100                    document[action]('mousemove', s.onTouchMove, moveCapture);
1101                    document[action]('mouseup', s.onTouchEnd, false);
1102                }
1103            }
1104            window[action]('resize', s.onResize);
1105
1106            // Next, Prev, Index
1107            if (s.params.nextButton) {
1108                $(s.params.nextButton)[actionDom]('click', s.onClickNext);
1109                if (s.params.a11y && s.a11y) $(s.params.nextButton)[actionDom]('keydown', s.a11y.onEnterKey);
1110            }
1111            if (s.params.prevButton) {
1112                $(s.params.prevButton)[actionDom]('click', s.onClickPrev);
1113                if (s.params.a11y && s.a11y) $(s.params.prevButton)[actionDom]('keydown', s.a11y.onEnterKey);
1114            }
1115            if (s.params.pagination && s.params.paginationClickable) {
1116                $(s.paginationContainer)[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);
1117                if (s.params.a11y && s.a11y) $(s.paginationContainer)[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);
1118            }
1119
1120            // Prevent Links Clicks
1121            if (s.params.preventClicks || s.params.preventClicksPropagation) touchEventsTarget[action]('click', s.preventClicks, true);
1122        };
1123        s.attachEvents = function (detach) {
1124            s.initEvents();
1125        };
1126        s.detachEvents = function () {
1127            s.initEvents(true);
1128        };
1129
1130        /*=========================
1131          Handle Clicks
1132          ===========================*/
1133        // Prevent Clicks
1134        s.allowClick = true;
1135        s.preventClicks = function (e) {
1136            if (!s.allowClick) {
1137                if (s.params.preventClicks) e.preventDefault();
1138                if (s.params.preventClicksPropagation && s.animating) {
1139                    e.stopPropagation();
1140                    e.stopImmediatePropagation();
1141                }
1142            }
1143        };
1144        // Clicks
1145        s.onClickNext = function (e) {
1146            e.preventDefault();
1147            if (s.isEnd && !s.params.loop) return;
1148            s.slideNext();
1149        };
1150        s.onClickPrev = function (e) {
1151            e.preventDefault();
1152            if (s.isBeginning && !s.params.loop) return;
1153            s.slidePrev();
1154        };
1155        s.onClickIndex = function (e) {
1156            e.preventDefault();
1157            var index = $(this).index() * s.params.slidesPerGroup;
1158            if (s.params.loop) index = index + s.loopedSlides;
1159            s.slideTo(index);
1160        };
1161
1162        /*=========================
1163          Handle Touches
1164          ===========================*/
1165        function findElementInEvent(e, selector) {
1166            var el = $(e.target);
1167            if (!el.is(selector)) {
1168                if (typeof selector === 'string') {
1169                    el = el.parents(selector);
1170                }
1171                else if (selector.nodeType) {
1172                    var found;
1173                    el.parents().each(function (index, _el) {
1174                        if (_el === selector) found = selector;
1175                    });
1176                    if (!found) return undefined;
1177                    else return selector;
1178                }
1179            }
1180            if (el.length === 0) {
1181                return undefined;
1182            }
1183            return el[0];
1184        }
1185        s.updateClickedSlide = function (e) {
1186            var slide = findElementInEvent(e, '.' + s.params.slideClass);
1187            var slideFound = false;
1188            if (slide) {
1189                for (var i = 0; i < s.slides.length; i++) {
1190                    if (s.slides[i] === slide) slideFound = true;
1191                }
1192            }
1193
1194            if (slide && slideFound) {
1195                s.clickedSlide = slide;
1196                s.clickedIndex = $(slide).index();
1197            }
1198            else {
1199                s.clickedSlide = undefined;
1200                s.clickedIndex = undefined;
1201                return;
1202            }
1203            if (s.params.slideToClickedSlide && s.clickedIndex !== undefined && s.clickedIndex !== s.activeIndex) {
1204                var slideToIndex = s.clickedIndex,
1205                    realIndex,
1206                    duplicatedSlides;
1207                if (s.params.loop) {
1208                    if (s.animating) return;
1209                    realIndex = $(s.clickedSlide).attr('data-swiper-slide-index');
1210                    if (s.params.centeredSlides) {
1211                        if ((slideToIndex < s.loopedSlides - s.params.slidesPerView/2) || (slideToIndex > s.slides.length - s.loopedSlides + s.params.slidesPerView/2)) {
1212                            s.fixLoop();
1213                            slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index="' + realIndex + '"]:not(.swiper-slide-duplicate)').eq(0).index();
1214                            setTimeout(function () {
1215                                s.slideTo(slideToIndex);
1216                            }, 0);
1217                        }
1218                        else {
1219                            s.slideTo(slideToIndex);
1220                        }
1221                    }
1222                    else {
1223                        if (slideToIndex > s.slides.length - s.params.slidesPerView) {
1224                            s.fixLoop();
1225                            slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index="' + realIndex + '"]:not(.swiper-slide-duplicate)').eq(0).index();
1226                            setTimeout(function () {
1227                                s.slideTo(slideToIndex);
1228                            }, 0);
1229                        }
1230                        else {
1231                            s.slideTo(slideToIndex);
1232                        }
1233                    }
1234                }
1235                else {
1236                    s.slideTo(slideToIndex);
1237                }
1238            }
1239        };
1240
1241        var isTouched,
1242            isMoved,
1243            allowTouchCallbacks,
1244            touchStartTime,
1245            isScrolling,
1246            currentTranslate,
1247            startTranslate,
1248            allowThresholdMove,
1249            // Form elements to match
1250            formElements = 'input, select, textarea, button',
1251            // Last click time
1252            lastClickTime = Date.now(), clickTimeout,
1253            //Velocities
1254            velocities = [],
1255            allowMomentumBounce;
1256
1257        // Animating Flag
1258        s.animating = false;
1259
1260        // Touches information
1261        s.touches = {
1262            startX: 0,
1263            startY: 0,
1264            currentX: 0,
1265            currentY: 0,
1266            diff: 0
1267        };
1268
1269        // Touch handlers
1270        var isTouchEvent, startMoving;
1271        s.onTouchStart = function (e) {
1272            if (e.originalEvent) e = e.originalEvent;
1273            isTouchEvent = e.type === 'touchstart';
1274            if (!isTouchEvent && 'which' in e && e.which === 3) return;
1275            if (s.params.noSwiping && findElementInEvent(e, '.' + s.params.noSwipingClass)) {
1276                s.allowClick = true;
1277                return;
1278            }
1279            if (s.params.swipeHandler) {
1280                if (!findElementInEvent(e, s.params.swipeHandler)) return;
1281            }
1282
1283            var startX = s.touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
1284            var startY = s.touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
1285
1286            // Do NOT start if iOS edge swipe is detected. Otherwise iOS app (UIWebView) cannot swipe-to-go-back anymore
1287            if(s.device.ios && s.params.iOSEdgeSwipeDetection && startX <= s.params.iOSEdgeSwipeThreshold) {
1288                return;
1289            }
1290
1291            isTouched = true;
1292            isMoved = false;
1293            allowTouchCallbacks = true;
1294            isScrolling = undefined;
1295            startMoving = undefined;
1296            s.touches.startX = startX;
1297            s.touches.startY = startY;
1298            touchStartTime = Date.now();
1299            s.allowClick = true;
1300            s.updateContainerSize();
1301            s.swipeDirection = undefined;
1302            if (s.params.threshold > 0) allowThresholdMove = false;
1303            if (e.type !== 'touchstart') {
1304                var preventDefault = true;
1305                if ($(e.target).is(formElements)) preventDefault = false;
1306                if (document.activeElement && $(document.activeElement).is(formElements)) {
1307                    document.activeElement.blur();
1308                }
1309                if (preventDefault) {
1310                    e.preventDefault();
1311                }
1312            }
1313            s.emit('onTouchStart', s, e);
1314        };
1315
1316        s.onTouchMove = function (e) {
1317            if (e.originalEvent) e = e.originalEvent;
1318            if (isTouchEvent && e.type === 'mousemove') return;
1319            if (e.preventedByNestedSwiper) return;
1320            if (s.params.onlyExternal) {
1321                // isMoved = true;
1322                s.allowClick = false;
1323                if (isTouched) {
1324                    s.touches.startX = s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
1325                    s.touches.startY = s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
1326                    touchStartTime = Date.now();
1327                }
1328                return;
1329            }
1330            if (isTouchEvent && document.activeElement) {
1331                if (e.target === document.activeElement && $(e.target).is(formElements)) {
1332                    isMoved = true;
1333                    s.allowClick = false;
1334                    return;
1335                }
1336            }
1337            if (allowTouchCallbacks) {
1338                s.emit('onTouchMove', s, e);
1339            }
1340            if (e.targetTouches && e.targetTouches.length > 1) return;
1341
1342            s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
1343            s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
1344
1345            if (typeof isScrolling === 'undefined') {
1346                var touchAngle = Math.atan2(Math.abs(s.touches.currentY - s.touches.startY), Math.abs(s.touches.currentX - s.touches.startX)) * 180 / Math.PI;
1347                isScrolling = isH() ? touchAngle > s.params.touchAngle : (90 - touchAngle > s.params.touchAngle);
1348            }
1349            if (isScrolling) {
1350                s.emit('onTouchMoveOpposite', s, e);
1351            }
1352            if (typeof startMoving === 'undefined' && s.browser.ieTouch) {
1353                if (s.touches.currentX !== s.touches.startX || s.touches.currentY !== s.touches.startY) {
1354                    startMoving = true;
1355                }
1356            }
1357            if (!isTouched) return;
1358            if (isScrolling)  {
1359                isTouched = false;
1360                return;
1361            }
1362            if (!startMoving && s.browser.ieTouch) {
1363                return;
1364            }
1365            s.allowClick = false;
1366            s.emit('onSliderMove', s, e);
1367            e.preventDefault();
1368            if (s.params.touchMoveStopPropagation && !s.params.nested) {
1369                e.stopPropagation();
1370            }
1371
1372            if (!isMoved) {
1373                if (params.loop) {
1374                    s.fixLoop();
1375                }
1376                startTranslate = s.getWrapperTranslate();
1377                s.setWrapperTransition(0);
1378                if (s.animating) {
1379                    s.wrapper.trigger('webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd');
1380                }
1381                if (s.params.autoplay && s.autoplaying) {
1382                    if (s.params.autoplayDisableOnInteraction) {
1383                        s.stopAutoplay();
1384                    }
1385                    else {
1386                        s.pauseAutoplay();
1387                    }
1388                }
1389                allowMomentumBounce = false;
1390                //Grab Cursor
1391                if (s.params.grabCursor) {
1392                    s.container[0].style.cursor = 'move';
1393                    s.container[0].style.cursor = '-webkit-grabbing';
1394                    s.container[0].style.cursor = '-moz-grabbin';
1395                    s.container[0].style.cursor = 'grabbing';
1396                }
1397            }
1398            isMoved = true;
1399
1400            var diff = s.touches.diff = isH() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;
1401
1402            diff = diff * s.params.touchRatio;
1403            if (s.rtl) diff = -diff;
1404
1405            s.swipeDirection = diff > 0 ? 'prev' : 'next';
1406  
1406          currentTranslate = diff + startTranslate;
1407
1408            var disableParentSwiper = true;
1409            if ((diff > 0 && currentTranslate > s.minTranslate())) {
1410                disableParentSwiper = false;
1411                if (s.params.resistance) currentTranslate = s.minTranslate() - 1 + Math.pow(-s.minTranslate() + startTranslate + diff, s.params.resistanceRatio);
1412            }
1413            else if (diff < 0 && currentTranslate < s.maxTranslate()) {
1414                disableParentSwiper = false;
1415                if (s.params.resistance) currentTranslate = s.maxTranslate() + 1 - Math.pow(s.maxTranslate() - startTranslate - diff, s.params.resistanceRatio);
1416            }
1417
1418            if (disableParentSwiper) {
1419                e.preventedByNestedSwiper = true;
1420            }
1421
1422            // Directions locks
1423            if (!s.params.allowSwipeToNext && s.swipeDirection === 'next' && currentTranslate < startTranslate) {
1424                currentTranslate = startTranslate;
1425            }
1426            if (!s.params.allowSwipeToPrev && s.swipeDirection === 'prev' && currentTranslate > startTranslate) {
1427                currentTranslate = startTranslate;
1428            }
1429
1430            if (!s.params.followFinger) return;
1431
1432            // Threshold
1433            if (s.params.threshold > 0) {
1434                if (Math.abs(diff) > s.params.threshold || allowThresholdMove) {
1435                    if (!allowThresholdMove) {
1436                        allowThresholdMove = true;
1437                        s.touches.startX = s.touches.currentX;
1438                        s.touches.startY = s.touches.currentY;
1439                        currentTranslate = startTranslate;
1440                        s.touches.diff = isH() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;
1441                        return;
1442                    }
1443                }
1444                else {
1445                    currentTranslate = startTranslate;
1446                    return;
1447                }
1448            }
1449            // Update active index in free mode
1450            if (s.params.freeMode || s.params.watchSlidesProgress) {
1451                s.updateActiveIndex();
1452            }
1453            if (s.params.freeMode) {
1454                //Velocity
1455                if (velocities.length === 0) {
1456                    velocities.push({
1457                        position: s.touches[isH() ? 'startX' : 'startY'],
1458                        time: touchStartTime
1459                    });
1460                }
1461                velocities.push({
1462                    position: s.touches[isH() ? 'currentX' : 'currentY'],
1463                    time: (new window.Date()).getTime()
1464                });
1465            }
1466            // Update progress
1467            s.updateProgress(currentTranslate);
1468            // Update translate
1469            s.setWrapperTranslate(currentTranslate);
1470        };
1471        s.onTouchEnd = function (e) {
1472            if (e.originalEvent) e = e.originalEvent;
1473            if (allowTouchCallbacks) {
1474                s.emit('onTouchEnd', s, e);
1475            }
1476            allowTouchCallbacks = false;
1477            if (!isTouched) return;
1478            //Return Grab Cursor
1479            if (s.params.grabCursor && isMoved && isTouched) {
1480                s.container[0].style.cursor = 'move';
1481                s.container[0].style.cursor = '-webkit-grab';
1482                s.container[0].style.cursor = '-moz-grab';
1483                s.container[0].style.cursor = 'grab';
1484            }
1485
1486            // Time diff
1487            var touchEndTime = Date.now();
1488            var timeDiff = touchEndTime - touchStartTime;
1489
1490            // Tap, doubleTap, Click
1491            if (s.allowClick) {
1492                s.updateClickedSlide(e);
1493                s.emit('onTap', s, e);
1494                if (timeDiff < 300 && (touchEndTime - lastClickTime) > 300) {
1495                    if (clickTimeout) clearTimeout(clickTimeout);
1496                    clickTimeout = setTimeout(function () {
1497                        if (!s) return;
1498                        if (s.params.paginationHide && s.paginationContainer.length > 0 && !$(e.target).hasClass(s.params.bulletClass)) {
1499                            s.paginationContainer.toggleClass(s.params.paginationHiddenClass);
1500                        }
1501                        s.emit('onClick', s, e);
1502                    }, 300);
1503
1504                }
1505                if (timeDiff < 300 && (touchEndTime - lastClickTime) < 300) {
1506                    if (clickTimeout) clearTimeout(clickTimeout);
1507                    s.emit('onDoubleTap', s, e);
1508                }
1509            }
1510
1511            lastClickTime = Date.now();
1512            setTimeout(function () {
1513                if (s) s.allowClick = true;
1514            }, 0);
1515
1516            if (!isTouched || !isMoved || !s.swipeDirection || s.touches.diff === 0 || currentTranslate === startTranslate) {
1517                isTouched = isMoved = false;
1518                return;
1519            }
1520            isTouched = isMoved = false;
1521
1522            var currentPos;
1523            if (s.params.followFinger) {
1524                currentPos = s.rtl ? s.translate : -s.translate;
1525            }
1526            else {
1527                currentPos = -currentTranslate;
1528            }
1529            if (s.params.freeMode) {
1530                if (currentPos < -s.minTranslate()) {
1531                    s.slideTo(s.activeIndex);
1532                    return;
1533                }
1534                else if (currentPos > -s.maxTranslate()) {
1535                    if (s.slides.length < s.snapGrid.length) {
1536                        s.slideTo(s.snapGrid.length - 1);
1537                    }
1538                    else {
1539                        s.slideTo(s.slides.length - 1);
1540                    }
1541                    return;
1542                }
1543
1544                if (s.params.freeModeMomentum) {
1545                    if (velocities.length > 1) {
1546                        var lastMoveEvent = velocities.pop(), velocityEvent = velocities.pop();
1547
1548                        var distance = lastMoveEvent.position - velocityEvent.position;
1549                        var time = lastMoveEvent.time - velocityEvent.time;
1550                        s.velocity = distance / time;
1551                        s.velocity = s.velocity / 2;
1552                        if (Math.abs(s.velocity) < s.params.freeModeMinimumVelocity) {
1553                            s.velocity = 0;
1554                        }
1555                        // this implies that the user stopped moving a finger then released.
1556                        // There would be no events with distance zero, so the last event is stale.
1557                        if (time > 150 || (new window.Date().getTime() - lastMoveEvent.time) > 300) {
1558                            s.velocity = 0;
1559                        }
1560                    } else {
1561                        s.velocity = 0;
1562                    }
1563
1564                    velocities.length = 0;
1565                    var momentumDuration = 1000 * s.params.freeModeMomentumRatio;
1566                    var momentumDistance = s.velocity * momentumDuration;
1567
1568                    var newPosition = s.translate + momentumDistance;
1569                    if (s.rtl) newPosition = - newPosition;
1570                    var doBounce = false;
1571                    var afterBouncePosition;
1572                    var bounceAmount = Math.abs(s.velocity) * 20 * s.params.freeModeMomentumBounceRatio;
1573                    if (newPosition < s.maxTranslate()) {
1574                        if (s.params.freeModeMomentumBounce) {
1575                            if (newPosition + s.maxTranslate() < -bounceAmount) {
1576                                newPosition = s.maxTranslate() - bounceAmount;
1577                            }
1578                            afterBouncePosition = s.maxTranslate();
1579                            doBounce = true;
1580                            allowMomentumBounce = true;
1581                        }
1582                        else {
1583                            newPosition = s.maxTranslate();
1584                        }
1585                    }
1586                    else if (newPosition > s.minTranslate()) {
1587                        if (s.params.freeModeMomentumBounce) {
1588                            if (newPosition - s.minTranslate() > bounceAmount) {
1589                                newPosition = s.minTranslate() + bounceAmount;
1590                            }
1591                            afterBouncePosition = s.minTranslate();
1592                            doBounce = true;
1593                            allowMomentumBounce = true;
1594                        }
1595                        else {
1596                            newPosition = s.minTranslate();
1597                        }
1598                    }
1599                    else if (s.params.freeModeSticky) {
1600                        var j = 0,
1601                            nextSlide;
1602                        for (j = 0; j < s.snapGrid.length; j += 1) {
1603                            if (s.snapGrid[j] > -newPosition) {
1604                                nextSlide = j;
1605                                break;
1606                            }
1607
1608                        }
1609                        if (Math.abs(s.snapGrid[nextSlide] - newPosition) < Math.abs(s.snapGrid[nextSlide - 1] - newPosition) || s.swipeDirection === 'next') {
1610                            newPosition = s.snapGrid[nextSlide];
1611                        } else {
1612                            newPosition = s.snapGrid[nextSlide - 1];
1613                        }
1614                        if (!s.rtl) newPosition = - newPosition;
1615                    }
1616                    //Fix duration
1617                    if (s.velocity !== 0) {
1618                        if (s.rtl) {
1619                            momentumDuration = Math.abs((-newPosition - s.translate) / s.velocity);
1620                        }
1621                        else {
1622                            momentumDuration = Math.abs((newPosition - s.translate) / s.velocity);
1623                        }
1624                    }
1625                    else if (s.params.freeModeSticky) {
1626                        s.slideReset();
1627                        return;
1628                    }
1629
1630                    if (s.params.freeModeMomentumBounce && doBounce) {
1631                        s.updateProgress(afterBouncePosition);
1632                        s.setWrapperTransition(momentumDuration);
1633                        s.setWrapperTranslate(newPosition);
1634                        s.onTransitionStart();
1635                        s.animating = true;
1636                        s.wrapper.transitionEnd(function () {
1637                            if (!s || !allowMomentumBounce) return;
1638                            s.emit('onMomentumBounce', s);
1639
1640                            s.setWrapperTransition(s.params.speed);
1641                            s.setWrapperTranslate(afterBouncePosition);
1642                            s.wrapper.transitionEnd(function () {
1643                                if (!s) return;
1644                                s.onTransitionEnd();
1645                            });
1646                        });
1647                    } else if (s.velocity) {
1648                        s.updateProgress(newPosition);
1649                        s.setWrapperTransition(momentumDuration);
1650                        s.setWrapperTranslate(newPosition);
1651                        s.onTransitionStart();
1652                        if (!s.animating) {
1653                            s.animating = true;
1654                            s.wrapper.transitionEnd(function () {
1655                                if (!s) return;
1656                                s.onTransitionEnd();
1657                            });
1658                        }
1659
1660                    } else {
1661                        s.updateProgress(newPosition);
1662                    }
1663
1664                    s.updateActiveIndex();
1665                }
1666                if (!s.params.freeModeMomentum || timeDiff >= s.params.longSwipesMs) {
1667                    s.updateProgress();
1668                    s.updateActiveIndex();
1669                }
1670                return;
1671            }
1672
1673            // Find current slide
1674            var i, stopIndex = 0, groupSize = s.slidesSizesGrid[0];
1675            for (i = 0; i < s.slidesGrid.length; i += s.params.slidesPerGroup) {
1676                if (typeof s.slidesGrid[i + s.params.slidesPerGroup] !== 'undefined') {
1677                    if (currentPos >= s.slidesGrid[i] && currentPos < s.slidesGrid[i + s.params.slidesPerGroup]) {
1678                        stopIndex = i;
1679                        groupSize = s.slidesGrid[i + s.params.slidesPerGroup] - s.slidesGrid[i];
1680                    }
1681                }
1682                else {
1683                    if (currentPos >= s.slidesGrid[i]) {
1684                        stopIndex = i;
1685                        groupSize = s.slidesGrid[s.slidesGrid.length - 1] - s.slidesGrid[s.slidesGrid.length - 2];
1686                    }
1687                }
1688            }
1689
1690            // Find current slide size
1691            var ratio = (currentPos - s.slidesGrid[stopIndex]) / groupSize;
1692
1693            if (timeDiff > s.params.longSwipesMs) {
1694                // Long touches
1695                if (!s.params.longSwipes) {
1696                    s.slideTo(s.activeIndex);
1697                    return;
1698                }
1699                if (s.swipeDirection === 'next') {
1700                    if (ratio >= s.params.longSwipesRatio) s.slideTo(stopIndex + s.params.slidesPerGroup);
1701                    else s.slideTo(stopIndex);
1702
1703                }
1704                if (s.swipeDirection === 'prev') {
1705                    if (ratio > (1 - s.params.longSwipesRatio)) s.slideTo(stopIndex + s.params.slidesPerGroup);
1706                    else s.slideTo(stopIndex);
1707                }
1708            }
1709            else {
1710                // Short swipes
1711                if (!s.params.shortSwipes) {
1712                    s.slideTo(s.activeIndex);
1713                    return;
1714                }
1715                if (s.swipeDirection === 'next') {
1716                    s.slideTo(stopIndex + s.params.slidesPerGroup);
1717
1718                }
1719                if (s.swipeDirection === 'prev') {
1720                    s.slideTo(stopIndex);
1721                }
1722            }
1723        };
1724        /*=========================
1725          Transitions
1726          ===========================*/
1727        s._slideTo = function (slideIndex, speed) {
1728            return s.slideTo(slideIndex, speed, true, true);
1729        };
1730        s.slideTo = function (slideIndex, speed, runCallbacks, internal) {
1731            if (typeof runCallbacks === 'undefined') runCallbacks = true;
1732            if (typeof slideIndex === 'undefined') slideIndex = 0;
1733            if (slideIndex < 0) slideIndex = 0;
1734            s.snapIndex = Math.floor(slideIndex / s.params.slidesPerGroup);
1735            if (s.snapIndex >= s.snapGrid.length) s.snapIndex = s.snapGrid.length - 1;
1736
1737            var translate = - s.snapGrid[s.snapIndex];
1738            // Stop autoplay
1739            if (s.params.autoplay && s.autoplaying) {
1740                if (internal || !s.params.autoplayDisableOnInteraction) {
1741                    s.pauseAutoplay(speed);
1742                }
1743                else {
1744                    s.stopAutoplay();
1745                }
1746            }
1747            // Update progress
1748            s.updateProgress(translate);
1749
1750            // Normalize slideIndex
1751            for (var i = 0; i < s.slidesGrid.length; i++) {
1752                if (- Math.floor(translate * 100) >= Math.floor(s.slidesGrid[i] * 100)) {
1753                    slideIndex = i;
1754                }
1755            }
1756
1757            // Directions locks
1758            if (!s.params.allowSwipeToNext && translate < s.translate && translate < s.minTranslate()) {
1759                return false;
1760            }
1761            if (!s.params.allowSwipeToPrev && translate > s.translate && translate > s.maxTranslate()) {
1762                if ((s.activeIndex || 0) !== slideIndex ) return false;
1763            }
1764
1765            // Update Index
1766            if (typeof speed === 'undefined') speed = s.params.speed;
1767            s.previousIndex = s.activeIndex || 0;
1768            s.activeIndex = slideIndex;
1769
1770            if ((s.rtl && -translate === s.translate) || (!s.rtl && translate === s.translate)) {
1771                // Update Height
1772                if (s.params.autoHeight) {
1773                    s.updateAutoHeight();
1774                }
1775                s.updateClasses();
1776                if (s.params.effect !== 'slide') {
1777                    s.setWrapperTranslate(translate);
1778                }
1779                return false;
1780            }
1781            s.updateClasses();
1782            s.onTransitionStart(runCallbacks);
1783
1784            if (speed === 0) {
1785                s.setWrapperTranslate(translate);
1786                s.setWrapperTransition(0);
1787                s.onTransitionEnd(runCallbacks);
1788            }
1789            else {
1790                s.setWrapperTranslate(translate);
1791                s.setWrapperTransition(speed);
1792                if (!s.animating) {
1793                    s.animating = true;
1794                    s.wrapper.transitionEnd(function () {
1795                        if (!s) return;
1796                        s.onTransitionEnd(runCallbacks);
1797                    });
1798                }
1799
1800            }
1801
1802            return true;
1803        };
1804
1805        s.onTransitionStart = function (runCallbacks) {
1806            if (typeof runCallbacks === 'undefined') runCallbacks = true;
1807            if (s.params.autoHeight) {
1808                s.updateAutoHeight();
1809            }
1810            if (s.lazy) s.lazy.onTransitionStart();
1811            if (runCallbacks) {
1812                s.emit('onTransitionStart', s);
1813                if (s.activeIndex !== s.previousIndex) {
1814                    s.emit('onSlideChangeStart', s);
1815                    if (s.activeIndex > s.previousIndex) {
1816                        s.emit('onSlideNextStart', s);
1817                    }
1818                    else {
1819                        s.emit('onSlidePrevStart', s);
1820                    }
1821                }
1822
1823            }
1824        };
1825        s.onTransitionEnd = function (runCallbacks) {
1826            s.animating = false;
1827            s.setWrapperTransition(0);
1828            if (typeof runCallbacks === 'undefined') runCallbacks = true;
1829            if (s.lazy) s.lazy.onTransitionEnd();
1830            if (runCallbacks) {
1831                s.emit('onTransitionEnd', s);
1832                if (s.activeIndex !== s.previousIndex) {
1833                    s.emit('onSlideChangeEnd', s);
1834                    if (s.activeIndex > s.previousIndex) {
1835                        s.emit('onSlideNextEnd', s);
1836                    }
1837                    else {
1838                        s.emit('onSlidePrevEnd', s);
1839                    }
1840                }
1841            }
1842            if (s.params.hashnav && s.hashnav) {
1843                s.hashnav.setHash();
1844            }
1845
1846        };
1847        s.slideNext = function (runCallbacks, speed, internal) {
1848            if (s.params.loop) {
1849                if (s.animating) return false;
1850                s.fixLoop();
1851                var clientLeft = s.container[0].clientLeft;
1852                return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);
1853            }
1854            else return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);
1855        };
1856        s._slideNext = function (speed) {
1857            return s.slideNext(true, speed, true);
1858        };
1859        s.slidePrev = function (runCallbacks, speed, internal) {
1860            if (s.params.loop) {
1861                if (s.animating) return false;
1862                s.fixLoop();
1863                var clientLeft = s.container[0].clientLeft;
1864                return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
1865            }
1866            else return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
1867        };
1868        s._slidePrev = function (speed) {
1869            return s.slidePrev(true, speed, true);
1870        };
1871        s.slideReset = function (runCallbacks, speed, internal) {
1872            return s.slideTo(s.activeIndex, speed, runCallbacks);
1873        };
1874
1875        /*=========================
1876          Translate/transition helpers
1877          ===========================*/
1878        s.setWrapperTransition = function (duration, byController) {
1879            s.wrapper.transition(duration);
1880            if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
1881                s.effects[s.params.effect].setTransition(duration);
1882            }
1883            if (s.params.parallax && s.parallax) {
1884                s.parallax.setTransition(duration);
1885            }
1886            if (s.params.scrollbar && s.scrollbar) {
1887                s.scrollbar.setTransition(duration);
1888            }
1889            if (s.params.control && s.controller) {
1890                s.controller.setTransition(duration, byController);
1891            }
1892            s.emit('onSetTransition', s, duration);
1893        };
1894        s.setWrapperTranslate = function (translate, updateActiveIndex, byController) {
1895            var x = 0, y = 0, z = 0;
1896            if (isH()) {
1897                x = s.rtl ? -translate : translate;
1898            }
1899            else {
1900                y = translate;
1901            }
1902
1903            if (s.params.roundLengths) {
1904                x = round(x);
1905                y = round(y);
1906            }
1907
1908            if (!s.params.virtualTranslate) {
1909                if (s.support.transforms3d) s.wrapper.transform('translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px)');
1910                else s.wrapper.transform('translate(' + x + 'px, ' + y + 'px)');
1911            }
1912
1913            s.translate = isH() ? x : y;
1914
1915            // Check if we need to update progress
1916            var progress;
1917            var translatesDiff = s.maxTranslate() - s.minTranslate();
1918            if (translatesDiff === 0) {
1919                progress = 0;
1920            }
1921            else {
1922                progress = (translate - s.minTranslate()) / (translatesDiff);
1923            }
1924            if (progress !== s.progress) {
1925                s.updateProgress(translate);
1926            }
1927
1928            if (updateActiveIndex) s.updateActiveIndex();
1929            if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
1930                s.effects[s.params.effect].setTranslate(s.translate);
1931            }
1932            if (s.params.parallax && s.parallax) {
1933                s.parallax.setTranslate(s.translate);
1934            }
1935            if (s.params.scrollbar && s.scrollbar) {
1936                s.scrollbar.setTranslate(s.translate);
1937            }
1938            if (s.params.control && s.controller) {
1939                s.controller.setTranslate(s.translate, byController);
1940            }
1941            s.emit('onSetTranslate', s, s.translate);
1942        };
1943
1944        s.getTranslate = function (el, axis) {
1945            var matrix, curTransform, curStyle, transformMatrix;
1946
1947            // automatic axis detection
1948            if (typeof axis === 'undefined') {
1949                axis = 'x';
1950            }
1951
1952            if (s.params.virtualTranslate) {
1953                return s.rtl ? -s.translate : s.translate;
1954            }
1955
1956            curStyle = window.getComputedStyle(el, null);
1957            if (window.WebKitCSSMatrix) {
1958                curTransform = curStyle.transform || curStyle.webkitTransform;
1959                if (curTransform.split(',').length > 6) {
1960                    curTransform = curTransform.split(', ').map(function(a){
1961                        return a.replace(',','.');
1962                    }).join(', ');
1963                }
1964                // Some old versions of Webkit choke when 'none' is passed; pass
1965                // empty string instead in this case
1966                transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
1967            }
1968            else {
1969                transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform  || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
1970                matrix = transformMatrix.toString().split(',');
1971            }
1972
1973            if (axis === 'x') {
1974                //Latest Chrome and webkits Fix
1975                if (window.WebKitCSSMatrix)
1976                    curTransform = transformMatrix.m41;
1977                //Crazy IE10 Matrix
1978                else if (matrix.length === 16)
1979                    curTransform = parseFloat(matrix[12]);
1980                //Normal Browsers
1981                else
1982                    curTransform = parseFloat(matrix[4]);
1983            }
1984            if (axis === 'y') {
1985                //Latest Chrome and webkits Fix
1986                if (window.WebKitCSSMatrix)
1987                    curTransform = transformMatrix.m42;
1988                //Crazy IE10 Matrix
1989                else if (matrix.length === 16)
1990                    curTransform = parseFloat(matrix[13]);
1991                //Normal Browsers
1992                else
1993                    curTransform = parseFloat(matrix[5]);
1994            }
1995            if (s.rtl && curTransform) curTransform = -curTransform;
1996            return curTransform || 0;
1997        };
1998        s.getWrapperTranslate = function (axis) {
1999            if (typeof axis === 'undefined') {
2000                axis = isH() ? 'x' : 'y';
2001            }
2002            return s.getTranslate(s.wrapper[0], axis);
2003        };
2004
2005        /*=========================
2006          Observer
2007          ===========================*/
2008        s.observers = [];
2009        function initObserver(target, options) {
2010            options = options || {};
2011            // create an observer instance
2012            var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
2013            var observer = new ObserverFunc(function (mutations) {
2014                mutations.forEach(function (mutation) {
2015                    s.onResize(true);
2016                    s.emit('onObserverUpdate', s, mutation);
2017                });
2018            });
2019
2020            observer.observe(target, {
2021                attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
2022                childList: typeof options.childList === 'undefined' ? true : options.childList,
2023                characterData: typeof options.characterData === 'undefined' ? true : options.characterData
2024            });
2025
2026            s.observers.push(observer);
2027        }
2028        s.initObservers = function () {
2029            if (s.params.observeParents) {
2030                var containerParents = s.container.parents();
2031                for (var i = 0; i < containerParents.length; i++) {
2032                    initObserver(containerParents[i]);
2033                }
2034            }
2035
2036            // Observe container
2037            initObserver(s.container[0], {childList: false});
2038
2039            // Observe wrapper
2040            initObserver(s.wrapper[0], {attributes: false});
2041        };
2042        s.disconnectObservers = function () {
2043            for (var i = 0; i < s.observers.length; i++) {
2044                s.observers[i].disconnect();
2045            }
2046            s.observers = [];
2047        };
2048        /*=========================
2049          Loop
2050          ===========================*/
2051        // Create looped slides
2052        s.createLoop = function () {
2053            // Remove duplicated slides
2054            s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
2055
2056            var slides = s.wrapper.children('.' + s.params.slideClass);
2057
2058            if(s.params.slidesPerView === 'auto' && !s.params.loopedSlides) s.params.loopedSlides = slides.length;
2059
2060            s.loopedSlides = parseInt(s.params.loopedSlides || s.params.slidesPerView, 10);
2061            s.loopedSlides = s.loopedSlides + s.params.loopAdditionalSlides;
2062            if (s.loopedSlides > slides.length) {
2063                s.loopedSlides = slides.length;
2064            }
2065
2066            var prependSlides = [], appendSlides = [], i;
2067            slides.each(function (index, el) {
2068                var slide = $(this);
2069                if (index < s.loopedSlides) appendSlides.push(el);
2070                if (index < slides.length && index >= slides.length - s.loopedSlides) prependSlides.push(el);
2071                slide.attr('data-swiper-slide-index', index);
2072            });
2073            for (i = 0; i < appendSlides.length; i++) {
2074                s.wrapper.append($(appendSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));
2075            }
2076            for (i = prependSlides.length - 1; i >= 0; i--) {
2077                s.wrapper.prepend($(prependSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));
2078            }
2079        };
2080        s.destroyLoop = function () {
2081            s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
2082            s.slides.removeAttr('data-swiper-slide-index');
2083        };
2084        s.fixLoop = function () {
2085            var newIndex;
2086            //Fix For Negative Oversliding
2087            if (s.activeIndex < s.loopedSlides) {
2088                newIndex = s.slides.length - s.loopedSlides * 3 + s.activeIndex;
2089                newIndex = newIndex + s.loopedSlides;
2090                s.slideTo(newIndex, 0, false, true);
2091            }
2092            //Fix For Positive Oversliding
2093            else if ((s.params.slidesPerView === 'auto' && s.activeIndex >= s.loopedSlides * 2) || (s.activeIndex > s.slides.length - s.params.slidesPerView * 2)) {
2094                newIndex = -s.slides.length + s.activeIndex + s.loopedSlides;
2095                newIndex = newIndex + s.loopedSlides;
2096                s.slideTo(newIndex, 0, false, true);
2097            }
2098        };
2099        /*=========================
2100          Append/Prepend/Remove Slides
2101          ===========================*/
2102        s.appendSlide = function (slides) {
2103            if (s.params.loop) {
2104                s.destroyLoop();
2105            }
2106            if (typeof slides === 'object' && slides.length) {
2107                for (var i = 0; i < slides.length; i++) {
2108                    if (slides[i]) s.wrapper.append(slides[i]);
2109                }
2110            }
2111            else {
2112                s.wrapper.append(slides);
2113            }
2114            if (s.params.loop) {
2115                s.createLoop();
2116            }
2117            if (!(s.params.observer && s.support.observer)) {
2118                s.update(true);
2119            }
2120        };
2121        s.prependSlide = function (slides) {
2122            if (s.params.loop) {
2123                s.destroyLoop();
2124            }
2125            var newActiveIndex = s.activeIndex + 1;
2126            if (typeof slides === 'object' && slides.length) {
2127                for (var i = 0; i < slides.length; i++) {
2128                    if (slides[i]) s.wrapper.prepend(slides[i]);
2129                }
2130                newActiveIndex = s.activeIndex + slides.length;
2131            }
2132            else {
2133                s.wrapper.prepend(slides);
2134            }
2135            if (s.params.loop) {
2136                s.createLoop();
2137            }
2138            if (!(s.params.observer && s.support.observer)) {
2139                s.update(true);
2140            }
2141            s.slideTo(newActiveIndex, 0, false);
2142        };
2143        s.removeSlide = function (slidesIndexes) {
2144            if (s.params.loop) {
2145                s.destroyLoop();
2146                s.slides = s.wrapper.children('.' + s.params.slideClass);
2147            }
2148            var newActiveIndex = s.activeIndex,
2149                indexToRemove;
2150            if (typeof slidesIndexes === 'object' && slidesIndexes.length) {
2151                for (var i = 0; i < slidesIndexes.length; i++) {
2152                    indexToRemove = slidesIndexes[i];
2153                    if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();
2154                    if (indexToRemove < newActiveIndex) newActiveIndex--;
2155                }
2156                newActiveIndex = Math.max(newActiveIndex, 0);
2157            }
2158            else {
2159                indexToRemove = slidesIndexes;
2160                if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();
2161                if (indexToRemove < newActiveIndex) newActiveIndex--;
2162                newActiveIndex = Math.max(newActiveIndex, 0);
2163            }
2164
2165            if (s.params.loop) {
2166                s.createLoop();
2167            }
2168
2169            if (!(s.params.observer && s.support.observer)) {
2170                s.update(true);
2171            }
2172            if (s.params.loop) {
2173                s.slideTo(newActiveIndex + s.loopedSlides, 0, false);
2174            }
2175            else {
2176                s.slideTo(newActiveIndex, 0, false);
2177            }
2178
2179        };
2180        s.removeAllSlides = function () {
2181            var slidesIndexes = [];
2182            for (var i = 0; i < s.slides.length; i++) {
2183                slidesIndexes.push(i);
2184            }
2185            s.removeSlide(slidesIndexes);
2186        };
2187
2188
2189        /*=========================
2190          Effects
2191          ===========================*/
2192        s.effects = {
2193            fade: {
2194                setTranslate: function () {
2195                    for (var i = 0; i < s.slides.length; i++) {
2196                        var slide = s.slides.eq(i);
2197                        var offset = slide[0].swiperSlideOffset;
2198                        var tx = -offset;
2199                        if (!s.params.virtualTranslate) tx = tx - s.translate;
2200                        var ty = 0;
2201                        if (!isH()) {
2202                            ty = tx;
2203                            tx = 0;
2204                        }
2205                        var slideOpacity = s.params.fade.crossFade ?
2206                                Math.max(1 - Math.abs(slide[0].progress), 0) :
2207                                1 + Math.min(Math.max(slide[0].progress, -1), 0);
2208                        slide
2209                            .css({
2210                                opacity: slideOpacity
2211                            })
2212                            .transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px)');
2213
2214                    }
2215
2216                },
2217                setTransition: function (duration) {
2218                    s.slides.transition(duration);
2219                    if (s.params.virtualTranslate && duration !== 0) {
2220                        var eventTriggered = false;
2221                        s.slides.transitionEnd(function () {
2222                            if (eventTriggered) return;
2223                            if (!s) return;
2224                            eventTriggered = true;
2225                            s.animating = false;
2226                            var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];
2227                            for (var i = 0; i < triggerEvents.length; i++) {
2228                                s.wrapper.trigger(triggerEvents[i]);
2229                            }
2230                        });
2231                    }
2232                }
2233            },
2234            cube: {
2235                setTranslate: function () {
2236                    var wrapperRotate = 0, cubeShadow;
2237                    if (s.params.cube.shadow) {
2238                        if (isH()) {
2239                            cubeShadow = s.wrapper.find('.swiper-cube-shadow');
2240                            if (cubeShadow.length === 0) {
2241                                cubeShadow = $('<div class="swiper-cube-shadow"></div>');
2242                                s.wrapper.append(cubeShadow);
2243                            }
2244                            cubeShadow.css({height: s.width + 'px'});
2245                        }
2246                        else {
2247                            cubeShadow = s.container.find('.swiper-cube-shadow');
2248                            if (cubeShadow.length === 0) {
2249                                cubeShadow = $('<div class="swiper-cube-shadow"></div>');
2250                                s.container.append(cubeShadow);
2251                            }
2252                        }
2253                    }
2254                    for (var i = 0; i < s.slides.length; i++) {
2255                        var slide = s.slides.eq(i);
2256                        var slideAngle = i * 90;
2257                        var round = Math.floor(slideAngle / 360);
2258                        if (s.rtl) {
2259                            slideAngle = -slideAngle;
2260                            round = Math.floor(-slideAngle / 360);
2261                        }
2262                        var progress = Math.max(Math.min(slide[0].progress, 1), -1);
2263                        var tx = 0, ty = 0, tz = 0;
2264                        if (i % 4 === 0) {
2265                            tx = - round * 4 * s.size;
2266                            tz = 0;
2267                        }
2268                        else if ((i - 1) % 4 === 0) {
2269                            tx = 0;
2270                            tz = - round * 4 * s.size;
2271                        }
2272                        else if ((i - 2) % 4 === 0) {
2273                            tx = s.size + round * 4 * s.size;
2274                            tz = s.size;
2275                        }
2276                        else if ((i - 3) % 4 === 0) {
2277                            tx = - s.size;
2278                            tz = 3 * s.size + s.size * 4 * round;
2279                        }
2280                        if (s.rtl) {
2281                            tx = -tx;
2282                        }
2283
2284                        if (!isH()) {
2285                            ty = tx;
2286                            tx = 0;
2287                        }
2288
2289                        var transform = 'rotateX(' + (isH() ? 0 : -slideAngle) + 'deg) rotateY(' + (isH() ? slideAngle : 0) + 'deg) translate3d(' + tx + 'px, ' + ty + 'px, ' + tz + 'px)';
2290                        if (progress <= 1 && progress > -1) {
2291                            wrapperRotate = i * 90 + progress * 90;
2292                            if (s.rtl) wrapperRotate = -i * 90 - progress * 90;
2293                        }
2294                        slide.transform(transform);
2295                        if (s.params.cube.slideShadows) {
2296                            //Set shadows
2297                            var shadowBefore = isH() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
2298                            var shadowAfter = isH() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
2299                            if (shadowBefore.length === 0) {
2300                                shadowBefore = $('<div class="swiper-slide-shadow-' + (isH() ? 'left' : 'top') + '"></div>');
2301                                slide.append(shadowBefore);
2302                            }
2303                            if (shadowAfter.length === 0) {
2304                                shadowAfter = $('<div class="swiper-slide-shadow-' + (isH() ? 'right' : 'bottom') + '"></div>');
2305                                slide.append(shadowAfter);
2306                            }
2307                            var shadowOpacity = slide[0].progress;
2308                            if (shadowBefore.length) shadowBefore[0].style.opacity = -slide[0].progress;
2309                            if (shadowAfter.length) shadowAfter[0].style.opacity = slide[0].progress;
2310                        }
2311                    }
2312                    s.wrapper.css({
2313                        '-webkit-transform-origin': '50% 50% -' + (s.size / 2) + 'px',
2314                        '-moz-transform-origin': '50% 50% -' + (s.size / 2) + 'px',
2315                        '-ms-transform-origin': '50% 50% -' + (s.size / 2) + 'px',
2316                        'transform-origin': '50% 50% -' + (s.size / 2) + 'px'
2317                    });
2318
2319                    if (s.params.cube.shadow) {
2320                        if (isH()) {
2321                            cubeShadow.transform('translate3d(0px, ' + (s.width / 2 + s.params.cube.shadowOffset) + 'px, ' + (-s.width / 2) + 'px) rotateX(90deg) rotateZ(0deg) scale(' + (s.params.cube.shadowScale) + ')');
2322                        }
2323                        else {
2324                            var shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;
2325                            var multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);
2326                            var scale1 = s.params.cube.shadowScale,
2327                                scale2 = s.params.cube.shadowScale / multiplier,
2328                                offset = s.params.cube.shadowOffset;
2329                            cubeShadow.transform('scale3d(' + scale1 + ', 1, ' + scale2 + ') translate3d(0px, ' + (s.height / 2 + offset) + 'px, ' + (-s.height / 2 / scale2) + 'px) rotateX(-90deg)');
2330                        }
2331                    }
2332                    var zFactor = (s.isSafari || s.isUiWebView) ? (-s.size / 2) : 0;
2333                    s.wrapper.transform('translate3d(0px,0,' + zFactor + 'px) rotateX(' + (isH() ? 0 : wrapperRotate) + 'deg) rotateY(' + (isH() ? -wrapperRotate : 0) + 'deg)');
2334                },
2335                setTransition: function (duration) {
2336                    s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
2337                    if (s.params.cube.shadow && !isH()) {
2338                        s.container.find('.swiper-cube-shadow').transition(duration);
2339                    }
2340                }
2341            },
2342            coverflow: {
2343                setTranslate: function () {
2344                    var transform = s.translate;
2345                    var center = isH() ? -transform + s.width / 2 : -transform + s.height / 2;
2346                    var rotate = isH() ? s.params.coverflow.rotate: -s.params.coverflow.rotate;
2347                    var translate = s.params.coverflow.depth;
2348                    //Each slide offset from center
2349                    for (var i = 0, length = s.slides.length; i < length; i++) {
2350                        var slide = s.slides.eq(i);
2351                        var slideSize = s.slidesSizesGrid[i];
2352                        var slideOffset = slide[0].swiperSlideOffset;
2353                        var offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * s.params.coverflow.modifier;
2354
2355                        var rotateY = isH() ? rotate * offsetMultiplier : 0;
2356                        var rotateX = isH() ? 0 : rotate * offsetMultiplier;
2357                        // var rotateZ = 0
2358                        var translateZ = -translate * Math.abs(offsetMultiplier);
2359
2360                        var translateY = isH() ? 0 : s.params.coverflow.stretch * (offsetMultiplier);
2361                        var translateX = isH() ? s.params.coverflow.stretch * (offsetMultiplier) : 0;
2362
2363                        //Fix for ultra small values
2364                        if (Math.abs(translateX) < 0.001) translateX = 0;
2365                        if (Math.abs(translateY) < 0.001) translateY = 0;
2366                        if (Math.abs(translateZ) < 0.001) translateZ = 0;
2367                        if (Math.abs(rotateY) < 0.001) rotateY = 0;
2368                        if (Math.abs(rotateX) < 0.001) rotateX = 0;
2369
2370                        var slideTransform = 'translate3d(' + translateX + 'px,' + translateY + 'px,' + translateZ + 'px)  rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)';
2371
2372                        slide.transform(slideTransform);
2373                        slide[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;
2374                        if (s.params.coverflow.slideShadows) {
2375                            //Set shadows
2376                            var shadowBefore = isH() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
2377                            var shadowAfter = isH() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
2378                            if (shadowBefore.length === 0) {
2379                                shadowBefore = $('<div class="swiper-slide-shadow-' + (isH() ? 'left' : 'top') + '"></div>');
2380                                slide.append(shadowBefore);
2381                            }
2382                            if (shadowAfter.length === 0) {
2383                                shadowAfter = $('<div class="swiper-slide-shadow-' + (isH() ? 'right' : 'bottom') + '"></div>');
2384                                slide.append(shadowAfter);
2385                            }
2386                            if (shadowBefore.length) shadowBefore[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;
2387                            if (shadowAfter.length) shadowAfter[0].style.opacity = (-offsetMultiplier) > 0 ? -offsetMultiplier : 0;
2388                        }
2389                    }
2390
2391                    //Set correct perspective for IE10
2392                    if (s.browser.ie) {
2393                        var ws = s.wrapper[0].style;
2394                        ws.perspectiveOrigin = center + 'px 50%';
2395                    }
2396                },
2397                setTransition: function (duration) {
2398                    s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
2399                }
2400            }
2401        };
2402
2403        /*=========================
2404          Images Lazy Loading
2405          ===========================*/
2406        s.lazy = {
2407            initialImageLoaded: false,
2408            loadImageInSlide: function (index, loadInDuplicate) {
2409                if (typeof index === 'undefined') return;
2410                if (typeof loadInDuplicate === 'undefined') loadInDuplicate = true;
2411                if (s.slides.length === 0) return;
2412
2413                var slide = s.slides.eq(index);
2414                var img = slide.find('.swiper-lazy:not(.swiper-lazy-loaded):not(.swiper-lazy-loading)');
2415                if (slide.hasClass('swiper-lazy') && !slide.hasClass('swiper-lazy-loaded') && !slide.hasClass('swiper-lazy-loading')) {
2416                    img = img.add(slide[0]);
2417                }
2418                if (img.length === 0) return;
2419
2420                img.each(function () {
2421                    var _img = $(this);
2422                    _img.addClass('swiper-lazy-loading');
2423                    var background = _img.attr('data-background');
2424                    var src = _img.attr('data-src'),
2425                        srcset = _img.attr('data-srcset');
2426                    s.loadImage(_img[0], (src || background), srcset, false, function () {
2427                        if (background) {
2428                            _img.css('background-image', 'url(' + background + ')');
2429                            _img.removeAttr('data-background');
2430                        }
2431                        else {
2432                            if (srcset) {
2433                                _img.attr('srcset', srcset);
2434                                _img.removeAttr('data-srcset');
2435                            }
2436                            if (src) {
2437                                _img.attr('src', src);
2438                                _img.removeAttr('data-src');
2439                            }
2440
2441                        }
2442
2443                        _img.addClass('swiper-lazy-loaded').removeClass('swiper-lazy-loading');
2444                        slide.find('.swiper-lazy-preloader, .preloader').remove();
2445                        if (s.params.loop && loadInDuplicate) {
2446                            var slideOriginalIndex = slide.attr('data-swiper-slide-index');
2447                            if (slide.hasClass(s.params.slideDuplicateClass)) {
2448                                var originalSlide = s.wrapper.children('[data-swiper-slide-index="' + slideOriginalIndex + '"]:not(.' + s.params.slideDuplicateClass + ')');
2449                                s.lazy.loadImageInSlide(originalSlide.index(), false);
2450                            }
2451                            else {
2452                                var duplicatedSlide = s.wrapper.children('.' + s.params.slideDuplicateClass + '[data-swiper-slide-index="' + slideOriginalIndex + '"]');
2453                                s.lazy.loadImageInSlide(duplicatedSlide.index(), false);
2454                            }
2455                        }
2456                        s.emit('onLazyImageReady', s, slide[0], _img[0]);
2457                    });
2458
2459                    s.emit('onLazyImageLoad', s, slide[0], _img[0]);
2460                });
2461
2462            },
2463            load: function () {
2464                var i;
2465                if (s.params.watchSlidesVisibility) {
2466                    s.wrapper.children('.' + s.params.slideVisibleClass).each(function () {
2467                        s.lazy.loadImageInSlide($(this).index());
2468                    });
2469                }
2470                else {
2471                    if (s.params.slidesPerView > 1) {
2472                        for (i = s.activeIndex; i < s.activeIndex + s.params.slidesPerView ; i++) {
2473                            if (s.slides[i]) s.lazy.loadImageInSlide(i);
2474                        }
2475                    }
2476                    else {
2477                        s.lazy.loadImageInSlide(s.activeIndex);
2478                    }
2479                }
2480                if (s.params.lazyLoadingInPrevNext) {
2481                    if (s.params.slidesPerView > 1) {
2482                        // Next Slides
2483                        for (i = s.activeIndex + s.params.slidesPerView; i < s.activeIndex + s.params.slidesPerView + s.params.slidesPerView; i++) {
2484                            if (s.slides[i]) s.lazy.loadImageInSlide(i);
2485                        }
2486                        // Prev Slides
2487                        for (i = s.activeIndex - s.params.slidesPerView; i < s.activeIndex ; i++) {
2488                            if (s.slides[i]) s.lazy.loadImageInSlide(i);
2489                        }
2490                    }
2491                    else {
2492                        var nextSlide = s.wrapper.children('.' + s.params.slideNextClass);
2493                        if (nextSlide.length > 0) s.lazy.loadImageInSlide(nextSlide.index());
2494
2495                        var prevSlide = s.wrapper.children('.' + s.params.slidePrevClass);
2496                        if (prevSlide.length > 0) s.lazy.loadImageInSlide(prevSlide.index());
2497                    }
2498                }
2499            },
2500            onTransitionStart: function () {
2501                if (s.params.lazyLoading) {
2502                    if (s.params.lazyLoadingOnTransitionStart || (!s.params.lazyLoadingOnTransitionStart && !s.lazy.initialImageLoaded)) {
2503                        s.lazy.load();
2504                    }
2505                }
2506            },
2507            onTransitionEnd: function () {
2508                if (s.params.lazyLoading && !s.params.lazyLoadingOnTransitionStart) {
2509                    s.lazy.load();
2510                }
2511            }
2512        };
2513
2514
2515        /*=========================
2516          Scrollbar
2517          ===========================*/
2518        s.scrollbar = {
2519            isTouched: false,
2520            setDragPosition: function (e) {
2521                var sb = s.scrollbar;
2522                var x = 0, y = 0;
2523                var translate;
2524                var pointerPosition = isH() ?
2525                    ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targetTouches[0].pageX : e.pageX || e.clientX) :
2526                    ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targetTouches[0].pageY : e.pageY || e.clientY) ;
2527                var position = (pointerPosition) - sb.track.offset()[isH() ? 'left' : 'top'] - sb.dragSize / 2;
2528                var positionMin = -s.minTranslate() * sb.moveDivider;
2529                var positionMax = -s.maxTranslate() * sb.moveDivider;
2530                if (position < positionMin) {
2531                    position = positionMin;
2532                }
2533                else if (position > positionMax) {
2534                    position = positionMax;
2535                }
2536                position = -position / sb.moveDivider;
2537                s.updateProgress(position);
2538                s.setWrapperTranslate(position, true);
2539            },
2540            dragStart: function (e) {
2541                var sb = s.scrollbar;
2542                sb.isTouched = true;
2543                e.preventDefault();
2544                e.stopPropagation();
2545
2546                sb.setDragPosition(e);
2547                clearTimeout(sb.dragTimeout);
2548
2549                sb.track.transition(0);
2550                if (s.params.scrollbarHide) {
2551                    sb.track.css('opacity', 1);
2552                }
2553                s.wrapper.transition(100);
2554                sb.drag.transition(100);
2555                s.emit('onScrollbarDragStart', s);
2556            },
2557            dragMove: function (e) {
2558                var sb = s.scrollbar;
2559                if (!sb.isTouched) return;
2560                if (e.preventDefault) e.preventDefault();
2561                else e.returnValue = false;
2562                sb.setDragPosition(e);
2563                s.wrapper.transition(0);
2564                sb.track.transition(0);
2565                sb.drag.transition(0);
2566                s.emit('onScrollbarDragMove', s);
2567            },
2568            dragEnd: function (e) {
2569                var sb = s.scrollbar;
2570                if (!sb.isTouched) return;
2571                sb.isTouched = false;
2572                if (s.params.scrollbarHide) {
2573                    clearTimeout(sb.dragTimeout);
2574                    sb.dragTimeout = setTimeout(function () {
2575                        sb.track.css('opacity', 0);
2576                        sb.track.transition(400);
2577                    }, 1000);
2578
2579                }
2580                s.emit('onScrollbarDragEnd', s);
2581                if (s.params.scrollbarSnapOnRelease) {
2582                    s.slideReset();
2583                }
2584            },
2585            enableDraggable: function () {
2586                var sb = s.scrollbar;
2587                var target = s.support.touch ? sb.track : document;
2588                $(sb.track).on(s.touchEvents.start, sb.dragStart);
2589                $(target).on(s.touchEvents.move, sb.dragMove);
2590                $(target).on(s.touchEvents.end, sb.dragEnd);
2591            },
2592            disableDraggable: function () {
2593                var sb = s.scrollbar;
2594                var target = s.support.touch ? sb.track : document;
2595                $(sb.track).off(s.touchEvents.start, sb.dragStart);
2596                $(target).off(s.touchEvents.move, sb.dragMove);
2597                $(target).off(s.touchEvents.end, sb.dragEnd);
2598            },
2599            set: function () {
2600                if (!s.params.scrollbar) return;
2601                var sb = s.scrollbar;
2602                sb.track = s.params.scrollbar;
2603                sb.drag = sb.track.find('.swiper-scrollbar-drag');
2604                if (sb.drag.length === 0) {
2605                    sb.drag = $('<div class="swiper-scrollbar-drag"></div>');
2606                    sb.track.append(sb.drag);
2607                }
2608                sb.drag[0].style.width = '';
2609                sb.drag[0].style.height = '';
2610                sb.trackSize = isH() ? sb.track[0].offsetWidth : sb.track[0].offsetHeight;
2611
2612                sb.divider = s.size / s.virtualSize;
2613                sb.moveDivider = sb.divider * (sb.trackSize / s.size);
2614                sb.dragSize = sb.trackSize * sb.divider;
2615
2616                if (isH()) {
2617                    sb.drag[0].style.width = sb.dragSize + 'px';
2618                }
2619                else {
2620                    sb.drag[0].style.height = sb.dragSize + 'px';
2621                }
2622
2623                if (sb.divider >= 1) {
2624                    sb.track[0].style.display = 'none';
2625                }
2626                else {
2627                    sb.track[0].style.display = '';
2628                }
2629                if (s.params.scrollbarHide) {
2630                    sb.track[0].style.opacity = 0;
2631                }
2632            },
2633            setTranslate: function () {
2634                if (!s.params.scrollbar) return;
2635                var diff;
2636                var sb = s.scrollbar;
2637                var translate = s.translate || 0;
2638                var newPos;
2639
2640                var newSize = sb.dragSize;
2641                newPos = (sb.trackSize - sb.dragSize) * s.progress;
2642                if (s.rtl && isH()) {
2643                    newPos = -newPos;
2644                    if (newPos > 0) {
2645                        newSize = sb.dragSize - newPos;
2646                        newPos = 0;
2647                    }
2648                    else if (-newPos + sb.dragSize > sb.trackSize) {
2649                        newSize = sb.trackSize + newPos;
2650                    }
2651                }
2652                else {
2653                    if (newPos < 0) {
2654                        newSize = sb.dragSize + newPos;
2655                        newPos = 0;
2656                    }
2657                    else if (newPos + sb.dragSize > sb.trackSize) {
2658                        newSize = sb.trackSize - newPos;
2659                    }
2660                }
2661                if (isH()) {
2662                    if (s.support.transforms3d) {
2663                        sb.drag.transform('translate3d(' + (newPos) + 'px, 0, 0)');
2664                    }
2665                    else {
2666                        sb.drag.transform('translateX(' + (newPos) + 'px)');
2667                    }
2668                    sb.drag[0].style.width = newSize + 'px';
2669                }
2670                else {
2671                    if (s.support.transforms3d) {
2672                        sb.drag.transform('translate3d(0px, ' + (newPos) + 'px, 0)');
2673                    }
2674                    else {
2675                        sb.drag.transform('translateY(' + (newPos) + 'px)');
2676                    }
2677                    sb.drag[0].style.height = newSize + 'px';
2678                }
2679                if (s.params.scrollbarHide) {
2680                    clearTimeout(sb.timeout);
2681                    sb.track[0].style.opacity = 1;
2682                    sb.timeout = setTimeout(function () {
2683                        sb.track[0].style.opacity = 0;
2684                        sb.track.transition(400);
2685                    }, 1000);
2686                }
2687            },
2688            setTransition: function (duration) {
2689                if (!s.params.scrollbar) return;
2690                s.scrollbar.drag.transition(duration);
2691            }
2692        };
2693
2694        /*=========================
2695          Controller
2696          ===========================*/
2697        s.controller = {
2698            LinearSpline: function (x, y) {
2699                this.x = x;
2700                this.y = y;
2701                this.lastIndex = x.length - 1;
2702                // Given an x value (x2), return the expected y2 value:
2703                // (x1,y1) is the known point before given value,
2704                // (x3,y3) is the known point after given value.
2705                var i1, i3;
2706                var l = this.x.length;
2707
2708                this.interpolate = function (x2) {
2709                    if (!x2) return 0;
2710
2711                    // Get the indexes of x1 and x3 (the array indexes before and after given x2):
2712                    i3 = binarySearch(this.x, x2);
2713                    i1 = i3 - 1;
2714
2715                    // We have our indexes i1 & i3, so we can calculate already:
2716                    // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1
2717                    return ((x2 - this.x[i1]) * (this.y[i3] - this.y[i1])) / (this.x[i3] - this.x[i1]) + this.y[i1];
2718                };
2719
2720                var binarySearch = (function() {
2721                    var maxIndex, minIndex, guess;
2722                    return function(array, val) {
2723                        minIndex = -1;
2724                        maxIndex = array.length;
2725                        while (maxIndex - minIndex > 1)
2726                            if (array[guess = maxIndex + minIndex >> 1] <= val) {
2727                                minIndex = guess;
2728                            } else {
2729                                maxIndex = guess;
2730                            }
2731                        return maxIndex;
2732                    };
2733                })();
2734            },
2735            //xxx: for now i will just save one spline function to to
2736            getInterpolateFunction: function(c){
2737                if(!s.controller.spline) s.controller.spline = s.params.loop ?
2738                    new s.controller.LinearSpline(s.slidesGrid, c.slidesGrid) :
2739                    new s.controller.LinearSpline(s.snapGrid, c.snapGrid);
2740            },
2741            setTranslate: function (translate, byController) {
2742               var controlled = s.params.control;
2743               var multiplier, controlledTranslate;
2744               function setControlledTranslate(c) {
2745                    // this will create an Interpolate function based on the snapGrids
2746                    // x is the Grid of the scrolled scroller and y will be the controlled scroller
2747                    // it makes sense to create this only once and recall it for the interpolation
2748                    // the function does a lot of value caching for performance
2749                    translate = c.rtl && c.params.direction === 'horizontal' ? -s.translate : s.translate;
2750                    if (s.params.controlBy === 'slide') {
2751                        s.controller.getInterpolateFunction(c);
2752                        // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid
2753                        // but it did not work out
2754                        controlledTranslate = -s.controller.spline.interpolate(-translate);
2755                    }
2756
2757                    if(!controlledTranslate || s.params.controlBy === 'container'){
2758                        multiplier = (c.maxTranslate() - c.minTranslate()) / (s.maxTranslate() - s.minTranslate());
2759                        controlledTranslate = (translate - s.minTranslate()) * multiplier + c.minTranslate();
2760                    }
2761
2762                    if (s.params.controlInverse) {
2763                        controlledTranslate = c.maxTranslate() - controlledTranslate;
2764                    }
2765                    c.updateProgress(controlledTranslate);
2766                    c.setWrapperTranslate(controlledTranslate, false, s);
2767                    c.updateActiveIndex();
2768               }
2769               if (s.isArray(controlled)) {
2770                   for (var i = 0; i < controlled.length; i++) {
2771                       if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
2772                           setControlledTranslate(controlled[i]);
2773                       }
2774                   }
2775               }
2776               else if (controlled instanceof Swiper && byController !== controlled) {
2777
2778                   setControlledTranslate(controlled);
2779               }
2780            },
2781            setTransition: function (duration, byController) {
2782                var controlled = s.params.control;
2783                var i;
2784                function setControlledTransition(c) {
2785                    c.setWrapperTransition(duration, s);
2786                    if (duration !== 0) {
2787                        c.onTransitionStart();
2788                        c.wrapper.transitionEnd(function(){
2789                            if (!controlled) return;
2790                            if (c.params.loop && s.params.controlBy === 'slide') {
2791                                c.fixLoop();
2792                            }
2793                            c.onTransitionEnd();
2794
2795                        });
2796                    }
2797                }
2798                if (s.isArray(controlled)) {
2799                    for (i = 0; i < controlled.length; i++) {
2800                        if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
2801                            setControlledTransition(controlled[i]);
2802                        }
2803                    }
2804                }
2805                else if (controlled instanceof Swiper && byController !== controlled) {
2806                    setControlledTransition(controlled);
2807                }
2808            }
2809        };
2810
2811        /*=========================
2812          Hash Navigation
2813          ===========================*/
2814        s.hashnav = {
2815            init: function () {
2816                if (!s.params.hashnav) return;
2817                s.hashnav.initialized = true;
2818                var hash = document.location.hash.replace('#', '');
2819                if (!hash) return;
2820                var speed = 0;
2821                for (var i = 0, length = s.slides.length; i < length; i++) {
2822                    var slide = s.slides.eq(i);
2823                    var slideHash = slide.attr('data-hash');
2824                    if (slideHash === hash && !slide.hasClass(s.params.slideDuplicateClass)) {
2825                        var index = slide.index();
2826                        s.slideTo(index, speed, s.params.runCallbacksOnInit, true);
2827                    }
2828                }
2829            },
2830            setHash: function () {
2831                if (!s.hashnav.initialized || !s.params.hashnav) return;
2832                document.location.hash = s.slides.eq(s.activeIndex).attr('data-hash') || '';
2833            }
2834        };
2835
2836        /*=========================
2837          Keyboard Control
2838          ===========================*/
2839        function handleKeyboard(e) {
2840            if (e.originalEvent) e = e.originalEvent; //jquery fix
2841            var kc = e.keyCode || e.charCode;
2842            // Directions locks
2843            if (!s.params.allowSwipeToNext && (isH() && kc === 39 || !isH() && kc === 40)) {
2844                return false;
2845            }
2846            if (!s.params.allowSwipeToPrev && (isH() && kc === 37 || !isH() && kc === 38)) {
2847                return false;
2848            }
2849            if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
2850                return;
2851            }
2852            if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {
2853                return;
2854            }
2855            if (kc === 37 || kc === 39 || kc === 38 || kc === 40) {
2856                var inView = false;
2857                //Check that swiper should be inside of visible area of window
2858                if (s.container.parents('.swiper-slide').length > 0 && s.container.parents('.swiper-slide-active').length === 0) {
2859                    return;
2860                }
2861                var windowScroll = {
2862                    left: window.pageXOffset,
2863                    top: window.pageYOffset
2864                };
2865                var windowWidth = window.innerWidth;
2866                var windowHeight = window.innerHeight;
2867                var swiperOffset = s.container.offset();
2868                if (s.rtl) swiperOffset.left = swiperOffset.left - s.container[0].scrollLeft;
2869                var swiperCoord = [
2870                    [swiperOffset.left, swiperOffset.top],
2871                    [swiperOffset.left + s.width, swiperOffset.top],
2872                    [swiperOffset.left, swiperOffset.top + s.height],
2873                    [swiperOffset.left + s.width, swiperOffset.top + s.height]
2874                ];
2875                for (var i = 0; i < swiperCoord.length; i++) {
2876                    var point = swiperCoord[i];
2877                    if (
2878                        point[0] >= windowScroll.left && point[0] <= windowScroll.left + windowWidth &&
2879                        point[1] >= windowScroll.top && point[1] <= windowScroll.top + windowHeight
2880                    ) {
2881                        inView = true;
2882                    }
2883
2884                }
2885                if (!inView) return;
2886            }
2887            if (isH()) {
2888                if (kc === 37 || kc === 39) {
2889                    if (e.preventDefault) e.preventDefault();
2890                    else e.returnValue = false;
2891                }
2892                if ((kc === 39 && !s.rtl) || (kc === 37 && s.rtl)) s.slideNext();
2893                if ((kc === 37 && !s.rtl) || (kc === 39 && s.rtl)) s.slidePrev();
2894            }
2895            else {
2896                if (kc === 38 || kc === 40) {
2897                    if (e.preventDefault) e.preventDefault();
2898                    else e.returnValue = false;
2899                }
2900                if (kc === 40) s.slideNext();
2901                if (kc === 38) s.slidePrev();
2902            }
2903        }
2904        s.disableKeyboardControl = function () {
2905            s.params.keyboardControl = false;
2906            $(document).off('keydown', handleKeyboard);
2907        };
2908        s.enableKeyboardControl = function () {
2909            s.params.keyboardControl = true;
2910            $(document).on('keydown', handleKeyboard);
2911        };
2912
2913
2914        /*=========================
2915          Mousewheel Control
2916          ===========================*/
2917        s.mousewheel = {
2918            event: false,
2919            lastScrollTime: (new window.Date()).getTime()
2920        };
2921        if (s.params.mousewheelControl) {
2922            try {
2923                new window.WheelEvent('wheel');
2924                s.mousewheel.event = 'wheel';
2925            } catch (e) {}
2926
2927            if (!s.mousewheel.event && document.onmousewheel !== undefined) {
2928                s.mousewheel.event = 'mousewheel';
2929            }
2930            if (!s.mousewheel.event) {
2931                s.mousewheel.event = 'DOMMouseScroll';
2932            }
2933        }
2934        function handleMousewheel(e) {
2935            if (e.originalEvent) e = e.originalEvent; //jquery fix
2936            var we = s.mousewheel.event;
2937            var delta = 0;
2938            var rtlFactor = s.rtl ? -1 : 1;
2939            //Opera & IE
2940            if (e.detail) delta = -e.detail;
2941            //WebKits
2942            else if (we === 'mousewheel') {
2943                if (s.params.mousewheelForceToAxis) {
2944                    if (isH()) {
2945                        if (Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY)) delta = e.wheelDeltaX * rtlFactor;
2946                        else return;
2947                    }
2948                    else {
2949                        if (Math.abs(e.wheelDeltaY) > Math.abs(e.wheelDeltaX)) delta = e.wheelDeltaY;
2950                        else return;
2951                    }
2952                }
2953                else {
2954                    delta = Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY) ? - e.wheelDeltaX * rtlFactor : - e.wheelDeltaY;
2955                }
2956            }
2957            //Old FireFox
2958            else if (we === 'DOMMouseScroll') delta = -e.detail;
2959            //New FireFox
2960            else if (we === 'wheel') {
2961                if (s.params.mousewheelForceToAxis) {
2962                    if (isH()) {
2963                        if (Math.abs(e.deltaX) > Math.abs(e.deltaY)) delta = -e.deltaX * rtlFactor;
2964                        else return;
2965                    }
2966                    else {
2967                        if (Math.abs(e.deltaY) > Math.abs(e.deltaX)) delta = -e.deltaY;
2968                        else return;
2969                    }
2970                }
2971                else {
2972                    delta = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? - e.deltaX * rtlFactor : - e.deltaY;
2973                }
2974            }
2975            if (delta === 0) return;
2976
2977            if (s.params.mousewheelInvert) delta = -delta;
2978
2979            if (!s.params.freeMode) {
2980                if ((new window.Date()).getTime() - s.mousewheel.lastScrollTime > 60) {
2981                    if (delta < 0) {
2982                        if ((!s.isEnd || s.params.loop) && !s.animating) s.slideNext();
2983                        else if (s.params.mousewheelReleaseOnEdges) return true;
2984                    }
2985                    else {
2986                        if ((!s.isBeginning || s.params.loop) && !s.animating) s.slidePrev();
2987                        else if (s.params.mousewheelReleaseOnEdges) return true;
2988                    }
2989                }
2990                s.mousewheel.lastScrollTime = (new window.Date()).getTime();
2991
2992            }
2993            else {
2994                //Freemode or scrollContainer:
2995                var position = s.getWrapperTranslate() + delta * s.params.mousewheelSensitivity;
2996                var wasBeginning = s.isBeginning,
2997                    wasEnd = s.isEnd;
2998
2999                if (position >= s.minTranslate()) position = s.minTranslate();
3000                if (position <= s.maxTranslate()) position = s.maxTranslate();
3001
3002                s.setWrapperTransition(0);
3003                s.setWrapperTranslate(position);
3004                s.updateProgress();
3005                s.updateActiveIndex();
3006
3007                if (!wasBeginning && s.isBeginning || !wasEnd && s.isEnd) {
3008                    s.updateClasses();
3009                }
3010
3011                if (s.params.freeModeSticky) {
3012                    clearTimeout(s.mousewheel.timeout);
3013                    s.mousewheel.timeout = setTimeout(function () {
3014                        s.slideReset();
3015                    }, 300);
3016                }
3017
3018                // Return page scroll on edge positions
3019                if (position === 0 || position === s.maxTranslate()) return;
3020            }
3021            if (s.params.autoplay) s.stopAutoplay();
3022
3023            if (e.preventDefault) e.preventDefault();
3024            else e.returnValue = false;
3025            return false;
3026        }
3027        s.disableMousewheelControl = function () {
3028            if (!s.mousewheel.event) return false;
3029            s.container.off(s.mousewheel.event, handleMousewheel);
3030            return true;
3031        };
3032
3033        s.enableMousewheelControl = function () {
3034            if (!s.mousewheel.event) return false;
3035            s.container.on(s.mousewheel.event, handleMousewheel);
3036            return true;
3037        };
3038
3039
3040        /*=========================
3041          Parallax
3042          ===========================*/
3043        function setParallaxTransform(el, progress) {
3044            el = $(el);
3045            var p, pX, pY;
3046            var rtlFactor = s.rtl ? -1 : 1;
3047
3048            p = el.attr('data-swiper-parallax') || '0';
3049            pX = el.attr('data-swiper-parallax-x');
3050            pY = el.attr('data-swiper-parallax-y');
3051            if (pX || pY) {
3052                pX = pX || '0';
3053                pY = pY || '0';
3054            }
3055            else {
3056                if (isH()) {
3057                    pX = p;
3058                    pY = '0';
3059                }
3060                else {
3061                    pY = p;
3062                    pX = '0';
3063                }
3064            }
3065
3066            if ((pX).indexOf('%') >= 0) {
3067                pX = parseInt(pX, 10) * progress * rtlFactor + '%';
3068            }
3069            else {
3070                pX = pX * progress * rtlFactor + 'px' ;
3071            }
3072            if ((pY).indexOf('%') >= 0) {
3073                pY = parseInt(pY, 10) * progress + '%';
3074            }
3075            else {
3076                pY = pY * progress + 'px' ;
3077            }
3078
3079            el.transform('translate3d(' + pX + ', ' + pY + ',0px)');
3080        }
3081        s.parallax = {
3082            setTranslate: function () {
3083                s.container.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function(){
3084                    setParallaxTransform(this, s.progress);
3085
3086                });
3087                s.slides.each(function () {
3088                    var slide = $(this);
3089                    slide.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
3090                        var progress = Math.min(Math.max(slide[0].progress, -1), 1);
3091                        setParallaxTransform(this, progress);
3092                    });
3093                });
3094            },
3095            setTransition: function (duration) {
3096                if (typeof duration === 'undefined') duration = s.params.speed;
3097                s.container.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function(){
3098                    var el = $(this);
3099                    var parallaxDuration = parseInt(el.attr('data-swiper-parallax-duration'), 10) || duration;
3100                    if (duration === 0) parallaxDuration = 0;
3101                    el.transition(parallaxDuration);
3102                });
3103            }
3104        };
3105
3106
3107        /*=========================
3108          Plugins API. Collect all and init all plugins
3109          ===========================*/
3110        s._plugins = [];
3111        for (var plugin in s.plugins) {
3112            var p = s.plugins[plugin](s, s.params[plugin]);
3113            if (p) s._plugins.push(p);
3114        }
3115        // Method to call all plugins event/method
3116        s.callPlugins = function (eventName) {
3117            for (var i = 0; i < s._plugins.length; i++) {
3118                if (eventName in s._plugins[i]) {
3119                    s._plugins[i][eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
3120                }
3121            }
3122        };
3123
3124        /*=========================
3125          Events/Callbacks/Plugins Emitter
3126          ===========================*/
3127        function normalizeEventName (eventName) {
3128            if (eventName.indexOf('on') !== 0) {
3129                if (eventName[0] !== eventName[0].toUpperCase()) {
3130                    eventName = 'on' + eventName[0].toUpperCase() + eventName.substring(1);
3131                }
3132                else {
3133                    eventName = 'on' + eventName;
3134                }
3135            }
3136            return eventName;
3137        }
3138        s.emitterEventListeners = {
3139
3140        };
3141        s.emit = function (eventName) {
3142            // Trigger callbacks
3143            if (s.params[eventName]) {
3144                s.params[eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
3145            }
3146            var i;
3147            // Trigger events
3148            if (s.emitterEventListeners[eventName]) {
3149                for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {
3150                    s.emitterEventListeners[eventName][i](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
3151                }
3152            }
3153            // Trigger plugins
3154            if (s.callPlugins) s.callPlugins(eventName, arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
3155        };
3156        s.on = function (eventName, handler) {
3157            eventName = normalizeEventName(eventName);
3158            if (!s.emitterEventListeners[eventName]) s.emitterEventListeners[eventName] = [];
3159            s.emitterEventListeners[eventName].push(handler);
3160            return s;
3161        };
3162        s.off = function (eventName, handler) {
3163            var i;
3164            eventName = normalizeEventName(eventName);
3165            if (typeof handler === 'undefined') {
3166                // Remove all handlers for such event
3167                s.emitterEventListeners[eventName] = [];
3168                return s;
3169            }
3170            if (!s.emitterEventListeners[eventName] || s.emitterEventListeners[eventName].length === 0) return;
3171            for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {
3172                if(s.emitterEventListeners[eventName][i] === handler) s.emitterEventListeners[eventName].splice(i, 1);
3173            }
3174            return s;
3175        };
3176        s.once = function (eventName, handler) {
3177            eventName = normalizeEventName(eventName);
3178            var _handler = function () {
3179                handler(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);
3180                s.off(eventName, _handler);
3181            };
3182            s.on(eventName, _handler);
3183            return s;
3184        };
3185
3186        // Accessibility tools
3187        s.a11y = {
3188            makeFocusable: function ($el) {
3189                $el.attr('tabIndex', '0');
3190                return $el;
3191            },
3192            addRole: function ($el, role) {
3193                $el.attr('role', role);
3194                return $el;
3195            },
3196
3197            addLabel: function ($el, label) {
3198                $el.attr('aria-label', label);
3199                return $el;
3200            },
3201
3202            disable: function ($el) {
3203                $el.attr('aria-disabled', true);
3204                return $el;
3205            },
3206
3207            enable: function ($el) {
3208                $el.attr('aria-disabled', false);
3209                return $el;
3210            },
3211
3212            onEnterKey: function (event) {
3213                if (event.keyCode !== 13) return;
3214                if ($(event.target).is(s.params.nextButton)) {
3215                    s.onClickNext(event);
3216                    if (s.isEnd) {
3217                        s.a11y.notify(s.params.lastSlideMessage);
3218                    }
3219                    else {
3220                        s.a11y.notify(s.params.nextSlideMessage);
3221                    }
3222                }
3223                else if ($(event.target).is(s.params.prevButton)) {
3224                    s.onClickPrev(event);
3225                    if (s.isBeginning) {
3226                        s.a11y.notify(s.params.firstSlideMessage);
3227                    }
3228                    else {
3229                        s.a11y.notify(s.params.prevSlideMessage);
3230                    }
3231                }
3232                if ($(event.target).is('.' + s.params.bulletClass)) {
3233                    $(event.target)[0].click();
3234                }
3235            },
3236
3237            liveRegion: $('<span class="swiper-notification" aria-l
3237ive="assertive" aria-atomic="true"></span>'),
3238
3239            notify: function (message) {
3240                var notification = s.a11y.liveRegion;
3241                if (notification.length === 0) return;
3242                notification.html('');
3243                notification.html(message);
3244            },
3245            init: function () {
3246                // Setup accessibility
3247                if (s.params.nextButton) {
3248                    var nextButton = $(s.params.nextButton);
3249                    s.a11y.makeFocusable(nextButton);
3250                    s.a11y.addRole(nextButton, 'button');
3251                    s.a11y.addLabel(nextButton, s.params.nextSlideMessage);
3252                }
3253                if (s.params.prevButton) {
3254                    var prevButton = $(s.params.prevButton);
3255                    s.a11y.makeFocusable(prevButton);
3256                    s.a11y.addRole(prevButton, 'button');
3257                    s.a11y.addLabel(prevButton, s.params.prevSlideMessage);
3258                }
3259
3260                $(s.container).append(s.a11y.liveRegion);
3261            },
3262            initPagination: function () {
3263                if (s.params.pagination && s.params.paginationClickable && s.bullets && s.bullets.length) {
3264                    s.bullets.each(function () {
3265                        var bullet = $(this);
3266                        s.a11y.makeFocusable(bullet);
3267                        s.a11y.addRole(bullet, 'button');
3268                        s.a11y.addLabel(bullet, s.params.paginationBulletMessage.replace(/{{index}}/, bullet.index() + 1));
3269                    });
3270                }
3271            },
3272            destroy: function () {
3273                if (s.a11y.liveRegion && s.a11y.liveRegion.length > 0) s.a11y.liveRegion.remove();
3274            }
3275        };
3276
3277
3278        /*=========================
3279          Init/Destroy
3280          ===========================*/
3281        s.init = function () {
3282            if (s.params.loop) s.createLoop();
3283            s.updateContainerSize();
3284            s.updateSlidesSize();
3285            s.updatePagination();
3286            if (s.params.scrollbar && s.scrollbar) {
3287                s.scrollbar.set();
3288                if (s.params.scrollbarDraggable) {
3289                    s.scrollbar.enableDraggable();
3290                }
3291            }
3292            if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
3293                if (!s.params.loop) s.updateProgress();
3294                s.effects[s.params.effect].setTranslate();
3295            }
3296            if (s.params.loop) {
3297                s.slideTo(s.params.initialSlide + s.loopedSlides, 0, s.params.runCallbacksOnInit);
3298            }
3299            else {
3300                s.slideTo(s.params.initialSlide, 0, s.params.runCallbacksOnInit);
3301                if (s.params.initialSlide === 0) {
3302                    if (s.parallax && s.params.parallax) s.parallax.setTranslate();
3303                    if (s.lazy && s.params.lazyLoading) {
3304                        s.lazy.load();
3305                        s.lazy.initialImageLoaded = true;
3306                    }
3307                }
3308            }
3309            s.attachEvents();
3310            if (s.params.observer && s.support.observer) {
3311                s.initObservers();
3312            }
3313            if (s.params.preloadImages && !s.params.lazyLoading) {
3314                s.preloadImages();
3315            }
3316            if (s.params.autoplay) {
3317                s.startAutoplay();
3318            }
3319            if (s.params.keyboardControl) {
3320                if (s.enableKeyboardControl) s.enableKeyboardControl();
3321            }
3322            if (s.params.mousewheelControl) {
3323                if (s.enableMousewheelControl) s.enableMousewheelControl();
3324            }
3325            if (s.params.hashnav) {
3326                if (s.hashnav) s.hashnav.init();
3327            }
3328            if (s.params.a11y && s.a11y) s.a11y.init();
3329            s.emit('onInit', s);
3330        };
3331
3332        // Cleanup dynamic styles
3333        s.cleanupStyles = function () {
3334            // Container
3335            s.container.removeClass(s.classNames.join(' ')).removeAttr('style');
3336
3337            // Wrapper
3338            s.wrapper.removeAttr('style');
3339
3340            // Slides
3341            if (s.slides && s.slides.length) {
3342                s.slides
3343                    .removeClass([
3344                      s.params.slideVisibleClass,
3345                      s.params.slideActiveClass,
3346                      s.params.slideNextClass,
3347                      s.params.slidePrevClass
3348                    ].join(' '))
3349                    .removeAttr('style')
3350                    .removeAttr('data-swiper-column')
3351                    .removeAttr('data-swiper-row');
3352            }
3353
3354            // Pagination/Bullets
3355            if (s.paginationContainer && s.paginationContainer.length) {
3356                s.paginationContainer.removeClass(s.params.paginationHiddenClass);
3357            }
3358            if (s.bullets && s.bullets.length) {
3359                s.bullets.removeClass(s.params.bulletActiveClass);
3360            }
3361
3362            // Buttons
3363            if (s.params.prevButton) $(s.params.prevButton).removeClass(s.params.buttonDisabledClass);
3364            if (s.params.nextButton) $(s.params.nextButton).removeClass(s.params.buttonDisabledClass);
3365
3366            // Scrollbar
3367            if (s.params.scrollbar && s.scrollbar) {
3368                if (s.scrollbar.track && s.scrollbar.track.length) s.scrollbar.track.removeAttr('style');
3369                if (s.scrollbar.drag && s.scrollbar.drag.length) s.scrollbar.drag.removeAttr('style');
3370            }
3371        };
3372
3373        // Destroy
3374        s.destroy = function (deleteInstance, cleanupStyles) {
3375            // Detach evebts
3376            s.detachEvents();
3377            // Stop autoplay
3378            s.stopAutoplay();
3379            // Disable draggable
3380            if (s.params.scrollbar && s.scrollbar) {
3381                if (s.params.scrollbarDraggable) {
3382                    s.scrollbar.disableDraggable();
3383                }
3384            }
3385            // Destroy loop
3386            if (s.params.loop) {
3387                s.destroyLoop();
3388            }
3389            // Cleanup styles
3390            if (cleanupStyles) {
3391                s.cleanupStyles();
3392            }
3393            // Disconnect observer
3394            s.disconnectObservers();
3395            // Disable keyboard/mousewheel
3396            if (s.params.keyboardControl) {
3397                if (s.disableKeyboardControl) s.disableKeyboardControl();
3398            }
3399            if (s.params.mousewheelControl) {
3400                if (s.disableMousewheelControl) s.disableMousewheelControl();
3401            }
3402            // Disable a11y
3403            if (s.params.a11y && s.a11y) s.a11y.destroy();
3404            // Destroy callback
3405            s.emit('onDestroy');
3406            // Delete instance
3407            if (deleteInstance !== false) s = null;
3408        };
3409
3410        s.init();
3411
3412
3413
3414        // Return swiper instance
3415        return s;
3416    };
3417
3418
3419    /*==================================================
3420        Prototype
3421    ====================================================*/
3422    Swiper.prototype = {
3423        isSafari: (function () {
3424            var ua = navigator.userAgent.toLowerCase();
3425            return (ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0);
3426        })(),
3427        isUiWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent),
3428        isArray: function (arr) {
3429            return Object.prototype.toString.apply(arr) === '[object Array]';
3430        },
3431        /*==================================================
3432        Browser
3433        ====================================================*/
3434        browser: {
3435            ie: window.navigator.pointerEnabled || window.navigator.msPointerEnabled,
3436            ieTouch: (window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints > 1) || (window.navigator.pointerEnabled && window.navigator.maxTouchPoints > 1)
3437        },
3438        /*==================================================
3439        Devices
3440        ====================================================*/
3441        device: (function () {
3442            var ua = navigator.userAgent;
3443            var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
3444            var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
3445            var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
3446            var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
3447            return {
3448                ios: ipad || iphone || ipod,
3449                android: android
3450            };
3451        })(),
3452        /*==================================================
3453        Feature Detection
3454        ====================================================*/
3455        support: {
3456            touch : (window.Modernizr && Modernizr.touch === true) || (function () {
3457                return !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch);
3458            })(),
3459
3460            transforms3d : (window.Modernizr && Modernizr.csstransforms3d === true) || (function () {
3461                var div = document.createElement('div').style;
3462                return ('webkitPerspective' in div || 'MozPerspective' in div || 'OPerspective' in div || 'MsPerspective' in div || 'perspective' in div);
3463            })(),
3464
3465            flexbox: (function () {
3466                var div = document.createElement('div').style;
3467                var styles = ('alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient').split(' ');
3468                for (var i = 0; i < styles.length; i++) {
3469                    if (styles[i] in div) return true;
3470                }
3471            })(),
3472
3473            observer: (function () {
3474                return ('MutationObserver' in window || 'WebkitMutationObserver' in window);
3475            })()
3476        },
3477        /*==================================================
3478        Plugins
3479        ====================================================*/
3480        plugins: {}
3481    };
3482
3483
3484    /*===========================
3485     Get Dom libraries
3486     ===========================*/
3487    var swiperDomPlugins = ['jQuery', 'Zepto', 'Dom7'];
3488    for (var i = 0; i < swiperDomPlugins.length; i++) {
3489    	if (window[swiperDomPlugins[i]]) {
3490    		addLibraryPlugin(window[swiperDomPlugins[i]]);
3491    	}
3492    }
3493    // Required DOM Plugins
3494    var domLib;
3495    if (typeof Dom7 === 'undefined') {
3496    	domLib = window.Dom7 || window.Zepto || window.jQuery;
3497    }
3498    else {
3499    	domLib = Dom7;
3500    }
3501
3502    /*===========================
3503    Add .swiper plugin from Dom libraries
3504    ===========================*/
3505    function addLibraryPlugin(lib) {
3506        lib.fn.swiper = function (params) {
3507            var firstInstance;
3508            lib(this).each(function () {
3509                var s = new Swiper(this, params);
3510                if (!firstInstance) firstInstance = s;
3511            });
3512            return firstInstance;
3513        };
3514    }
3515
3516    if (domLib) {
3517        if (!('transitionEnd' in domLib.fn)) {
3518            domLib.fn.transitionEnd = function (callback) {
3519                var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],
3520                    i, j, dom = this;
3521                function fireCallBack(e) {
3522                    /*jshint validthis:true */
3523                    if (e.target !== this) return;
3524                    callback.call(this, e);
3525                    for (i = 0; i < events.length; i++) {
3526                        dom.off(events[i], fireCallBack);
3527                    }
3528                }
3529                if (callback) {
3530                    for (i = 0; i < events.length; i++) {
3531                        dom.on(events[i], fireCallBack);
3532                    }
3533                }
3534                return this;
3535            };
3536        }
3537        if (!('transform' in domLib.fn)) {
3538            domLib.fn.transform = function (transform) {
3539                for (var i = 0; i < this.length; i++) {
3540                    var elStyle = this[i].style;
3541                    elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = transform;
3542                }
3543                return this;
3544            };
3545        }
3546        if (!('transition' in domLib.fn)) {
3547            domLib.fn.transition = function (duration) {
3548                if (typeof duration !== 'string') {
3549                    duration = duration + 'ms';
3550                }
3551                for (var i = 0; i < this.length; i++) {
3552                    var elStyle = this[i].style;
3553                    elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;
3554                }
3555                return this;
3556            };
3557        }
3558    }
3559
3560    window.Swiper = Swiper;
3561})();
3562/*===========================
3563Swiper AMD Export
3564===========================*/
3565if (typeof(module) !== 'undefined')
3566{
3567    module.exports = window.Swiper;
3568}
3569else if (typeof define === 'function' && define.amd) {
3570    define([], function () {
3571        'use strict';
3572        return window.Swiper;
3573    });
3574}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.