PageSourceSearch

https://www.diariosur.es/contentfactory/post/wp-content/themes/cms-native/js/swiper.js?444

js diariosur.es collected 2026-09-24 08:37:44 UTC 168,379 bytes, 3,965 lines download raw bytes

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

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.