PageSourceSearch

https://www.kletterhallewien.at/static/libs/swiper/src/idangerous.swiper.js

js kletterhallewien.at collected 2026-10-04 08:44:32 UTC 111,838 bytes, 2,831 lines download raw bytes

1var Swiper = function (selector, params) {
2    'use strict';
3
4    /*=========================
5      A little bit dirty but required part for IE8 and old FF support
6      ===========================*/
7    if (!document.body.outerHTML && document.body.__defineGetter__) {
8        if (HTMLElement) {
9            var element = HTMLElement.prototype;
10            if (element.__defineGetter__) {
11                element.__defineGetter__('outerHTML', function () { return new XMLSerializer().serializeToString(this); });
12            }
13        }
14    }
15
16    if (!window.getComputedStyle) {
17        window.getComputedStyle = function (el, pseudo) {
18            this.el = el;
19            this.getPropertyValue = function (prop) {
20                var re = /(\-([a-z]){1})/g;
21                if (prop === 'float') prop = 'styleFloat';
22                if (re.test(prop)) {
23                    prop = prop.replace(re, function () {
24                        return arguments[2].toUpperCase();
25                    });
26                }
27                return el.currentStyle[prop] ? el.currentStyle[prop] : null;
28            };
29            return this;
30        };
31    }
32    if (!Array.prototype.indexOf) {
33        Array.prototype.indexOf = function (obj, start) {
34            for (var i = (start || 0), j = this.length; i < j; i++) {
35                if (this[i] === obj) { return i; }
36            }
37            return -1;
38        };
39    }
40    if (!document.querySelectorAll) {
41        if (!window.jQuery) return;
42    }
43    function $$(selector, context) {
44        if (document.querySelectorAll)
45            return (context || document).querySelectorAll(selector);
46        else
47            return jQuery(selector, context);
48    }
49
50    /*=========================
51      Check for correct selector
52      ===========================*/
53    if (typeof selector === 'undefined') return;
54
55    if (!(selector.nodeType)) {
56        if ($$(selector).length === 0) return;
57    }
58
59     /*=========================
60      _this
61      ===========================*/
62    var _this = this;
63
64     /*=========================
65      Default Flags and vars
66      ===========================*/
67    _this.touches = {
68        start: 0,
69        startX: 0,
70        startY: 0,
71        current: 0,
72        currentX: 0,
73        currentY: 0,
74        diff: 0,
75        abs: 0
76    };
77    _this.positions = {
78        start: 0,
79        abs: 0,
80        diff: 0,
81        current: 0
82    };
83    _this.times = {
84        start: 0,
85        end: 0
86    };
87
88    _this.id = (new Date()).getTime();
89    _this.container = (selector.nodeType) ? selector : $$(selector)[0];
90    _this.isTouched = false;
91    _this.isMoved = false;
92    _this.activeIndex = 0;
93    _this.centerIndex = 0;
94    _this.activeLoaderIndex = 0;
95    _this.activeLoopIndex = 0;
96    _this.previousIndex = null;
97    _this.velocity = 0;
98    _this.snapGrid = [];
99    _this.slidesGrid = [];
100    _this.imagesToLoad = [];
101    _this.imagesLoaded = 0;
102    _this.wrapperLeft = 0;
103    _this.wrapperRight = 0;
104    _this.wrapperTop = 0;
105    _this.wrapperBottom = 0;
106    _this.isAndroid = navigator.userAgent.toLowerCase().indexOf('android') >= 0;
107    var wrapper, slideSize, wrapperSize, direction, isScrolling, containerSize;
108
109    /*=========================
110      Default Parameters
111      ===========================*/
112    var defaults = {
113        eventTarget: 'wrapper', // or 'container'
114        mode : 'horizontal', // or 'vertical'
115        touchRatio : 1,
116        speed : 300,
117        freeMode : false,
118        freeModeFluid : false,
119        momentumRatio: 1,
120        momentumBounce: true,
121        momentumBounceRatio: 1,
122        slidesPerView : 1,
123        slidesPerGroup : 1,
124        slidesPerViewFit: true, //Fit to slide when spv "auto" and slides larger than container
125        simulateTouch : true,
126        followFinger : true,
127        shortSwipes : true,
128        longSwipesRatio: 0.5,
129        moveStartThreshold: false,
130        onlyExternal : false,
131        createPagination : true,
132        pagination : false,
133        paginationElement: 'span',
134        paginationClickable: false,
135        paginationAsRange: true,
136        resistance : true, // or false or 100%
137        scrollContainer : false,
138        preventLinks : true,
139        preventLinksPropagation: false,
140        noSwiping : false, // or class
141        noSwipingClass : 'swiper-no-swiping', //:)
142        initialSlide: 0,
143        keyboardControl: false,
144        mousewheelControl : false,
145        mousewheelControlForceToAxis : false,
146        useCSS3Transforms : true,
147        // Autoplay
148        autoplay: false,
149        autoplayDisableOnInteraction: true,
150        autoplayStopOnLast: false,
151        //Loop mode
152        loop: false,
153        loopAdditionalSlides: 0,
154        // Round length values
155        roundLengths: false,
156        //Auto Height
157        calculateHeight: false,
158        //Apply CSS for width and/or height
159        cssWidthAndHeight: false, // or true or 'width' or 'height'
160        //Images Preloader
161        updateOnImagesReady : true,
162        //Form elements
163        releaseFormElements : true,
164        //Watch for active slide, useful when use effects on different slide states
165        watchActiveIndex: false,
166        //Slides Visibility Fit
167        visibilityFullFit : false,
168        //Slides Offset
169        offsetPxBefore : 0,
170        offsetPxAfter : 0,
171        offsetSlidesBefore : 0,
172        offsetSlidesAfter : 0,
173        centeredSlides: false,
174        //Queue callbacks
175        queueStartCallbacks : false,
176        queueEndCallbacks : false,
177        //Auto Resize
178        autoResize : true,
179        resizeReInit : false,
180        //DOMAnimation
181        DOMAnimation : true,
182        //Slides Loader
183        loader: {
184            slides: [], //array with slides
185            slidesHTMLType: 'inner', // or 'outer'
186            surroundGroups: 1, //keep preloaded slides groups around view
187            logic: 'reload', //or 'change'
188            loadAllSlides: false
189        },
190        // One way swipes
191        swipeToPrev: true,
192        swipeToNext: true,
193        //Namespace
194        slideElement: 'div',
195        slideClass: 'swiper-slide',
196        slideActiveClass: 'swiper-slide-active',
197        slideVisibleClass: 'swiper-slide-visible',
198        slideDuplicateClass: 'swiper-slide-duplicate',
199        wrapperClass: 'swiper-wrapper',
200        paginationElementClass: 'swiper-pagination-switch',
201        paginationActiveClass: 'swiper-active-switch',
202        paginationVisibleClass: 'swiper-visible-switch'
203    };
204    params = params || {};
205    for (var prop in defaults) {
206        if (prop in params && typeof params[prop] === 'object') {
207            for (var subProp in defaults[prop]) {
208                if (! (subProp in params[prop])) {
209                    params[prop][subProp] = defaults[prop][subProp];
210                }
211            }
212        }
213        else if (! (prop in params)) {
214            params[prop] = defaults[prop];
215        }
216    }
217    _this.params = params;
218    if (params.scrollContainer) {
219        params.freeMode = true;
220        params.freeModeFluid = true;
221    }
222    if (params.loop) {
223        params.resistance = '100%';
224    }
225    var isH = params.mode === 'horizontal';
226
227    /*=========================
228      Define Touch Events
229      ===========================*/
230    var desktopEvents = ['mousedown', 'mousemove', 'mouseup'];
231    if (_this.browser.ie10) desktopEvents = ['MSPointerDown', 'MSPointerMove', 'MSPointerUp'];
232    if (_this.browser.ie11) desktopEvents = ['pointerdown', 'pointermove', 'pointerup'];
233
234    _this.touchEvents = {
235        touchStart : _this.support.touch || !params.simulateTouch  ? 'touchstart' : desktopEvents[0],
236        touchMove : _this.support.touch || !params.simulateTouch ? 'touchmove' : desktopEvents[1],
237        touchEnd : _this.support.touch || !params.simulateTouch ? 'touchend' : desktopEvents[2]
238    };
239
240    /*=========================
241      Wrapper
242      ===========================*/
243    for (var i = _this.container.childNodes.length - 1; i >= 0; i--) {
244        if (_this.container.childNodes[i].className) {
245            var _wrapperClasses = _this.container.childNodes[i].className.split(/\s+/);
246            for (var j = 0; j < _wrapperClasses.length; j++) {
247                if (_wrapperClasses[j] === params.wrapperClass) {
248                    wrapper = _this.container.childNodes[i];
249                }
250            }
251        }
252    }
253
254    _this.wrapper = wrapper;
255    /*=========================
256      Slide API
257      ===========================*/
258    _this._extendSwiperSlide = function  (el) {
259        el.append = function () {
260            if (params.loop) {
261                el.insertAfter(_this.slides.length - _this.loopedSlides);
262            }
263            else {
264                _this.wrapper.appendChild(el);
265                _this.reInit();
266            }
267
268            return el;
269        };
270        el.prepend = function () {
271            if (params.loop) {
272                _this.wrapper.insertBefore(el, _this.slides[_this.loopedSlides]);
273                _this.removeLoopedSlides();
274                _this.calcSlides();
275                _this.createLoop();
276            }
277            else {
278                _this.wrapper.insertBefore(el, _this.wrapper.firstChild);
279            }
280            _this.reInit();
281            return el;
282        };
283        el.insertAfter = function (index) {
284            if (typeof index === 'undefined') return false;
285            var beforeSlide;
286
287            if (params.loop) {
288                beforeSlide = _this.slides[index + 1 + _this.loopedSlides];
289                if (beforeSlide) {
290                    _this.wrapper.insertBefore(el, beforeSlide);
291                }
292                else {
293                    _this.wrapper.appendChild(el);
294                }
295                _this.removeLoopedSlides();
296                _this.calcSlides();
297                _this.createLoop();
298            }
299            else {
300                beforeSlide = _this.slides[index + 1];
301                _this.wrapper.insertBefore(el, beforeSlide);
302            }
303            _this.reInit();
304            return el;
305        };
306        el.clone = function () {
307            return _this._extendSwiperSlide(el.cloneNode(true));
308        };
309        el.remove = function () {
310            _this.wrapper.removeChild(el);
311            _this.reInit();
312        };
313        el.html = function (html) {
314            if (typeof html === 'undefined') {
315                return el.innerHTML;
316            }
317            else {
318                el.innerHTML = html;
319                return el;
320            }
321        };
322        el.index = function () {
323            var index;
324            for (var i = _this.slides.length - 1; i >= 0; i--) {
325                if (el === _this.slides[i]) index = i;
326            }
327            return index;
328        };
329        el.isActive = function () {
330            if (el.index() === _this.activeIndex) return true;
331            else return false;
332        };
333        if (!el.swiperSlideDataStorage) el.swiperSlideDataStorage = {};
334        el.getData = function (name) {
335            return el.swiperSlideDataStorage[name];
336        };
337        el.setData = function (name, value) {
338            el.swiperSlideDataStorage[name] = value;
339            return el;
340        };
341        el.data = function (name, value) {
342            if (typeof value === 'undefined') {
343                return el.getAttribute('data-' + name);
344            }
345            else {
346                el.setAttribute('data-' + name, value);
347                return el;
348            }
349        };
350        el.getWidth = function (outer, round) {
351            return _this.h.getWidth(el, outer, round);
352        };
353        el.getHeight = function (outer, round) {
354            return _this.h.getHeight(el, outer, round);
355        };
356        el.getOffset = function () {
357            return _this.h.getOffset(el);
358        };
359        return el;
360    };
361
362    //Calculate information about number of slides
363    _this.calcSlides = function (forceCalcSlides) {
364        var oldNumber = _this.slides ? _this.slides.length : false;
365        _this.slides = [];
366        _this.displaySlides = [];
367        for (var i = 0; i < _this.wrapper.childNodes.length; i++) {
368            if (_this.wrapper.childNodes[i].className) {
369                var _className = _this.wrapper.childNodes[i].className;
370                var _slideClasses = _className.split(/\s+/);
371                for (var j = 0; j < _slideClasses.length; j++) {
372                    if (_slideClasses[j] === params.slideClass) {
373                        _this.slides.push(_this.wrapper.childNodes[i]);
374                    }
375                }
376            }
377        }
378        for (i = _this.slides.length - 1; i >= 0; i--) {
379            _this._extendSwiperSlide(_this.slides[i]);
380        }
381        if (oldNumber === false) return;
382        if (oldNumber !== _this.slides.length || forceCalcSlides) {
383
384            // Number of slides has been changed
385            removeSlideEvents();
386            addSlideEvents();
387            _this.updateActiveSlide();
388            if (_this.params.pagination) _this.createPagination();
389            _this.callPlugins('numberOfSlidesChanged');
390        }
391    };
392
393    //Create Slide
394    _this.createSlide = function (html, slideClassList, el) {
395        slideClassList = slideClassList || _this.params.slideClass;
396        el = el || params.slideElement;
397        var newSlide = document.createElement(el);
398        newSlide.innerHTML = html || '';
399        newSlide.className = slideClassList;
400        return _this._extendSwiperSlide(newSlide);
401    };
402
403    //Append Slide
404    _this.appendSlide = function (html, slideClassList, el) {
405        if (!html) return;
406        if (html.nodeType) {
407            return _this._extendSwiperSlide(html).append();
408        }
409        else {
410            return _this.createSlide(html, slideClassList, el).append();
411        }
412    };
413    _this.prependSlide = function (html, slideClassList, el) {
414        if (!html) return;
415        if (html.nodeType) {
416            return _this._extendSwiperSlide(html).prepend();
417        }
418        else {
419            return _this.createSlide(html, slideClassList, el).prepend();
420        }
421    };
422    _this.insertSlideAfter = function (index, html, slideClassList, el) {
423        if (typeof index === 'undefined') return false;
424        if (html.nodeType) {
425            return _this._extendSwiperSlide(html).insertAfter(index);
426        }
427        else {
428            return _this.createSlide(html, slideClassList, el).insertAfter(index);
429        }
430    };
431    _this.removeSlide = function (index) {
432        if (_this.slides[index]) {
433            if (params.loop) {
434                if (!_this.slides[index + _this.loopedSlides]) return false;
435                _this.slides[index + _this.loopedSlides].remove();
436                _this.removeLoopedSlides();
437                _this.calcSlides();
438                _this.createLoop();
439            }
440            else _this.slides[index].remove();
441            return true;
442        }
443        else return false;
444    };
445    _this.removeLastSlide = function () {
446        if (_this.slides.length > 0) {
447            if (params.loop) {
448                _this.slides[_this.slides.length - 1 - _this.loopedSlides].remove();
449                _this.removeLoopedSlides();
450                _this.calcSlides();
451                _this.createLoop();
452            }
453            else _this.slides[_this.slides.length - 1].remove();
454            return true;
455        }
456        else {
457            return false;
458        }
459    };
460    _this.removeAllSlides = function () {
461        for (var i = _this.slides.length - 1; i >= 0; i--) {
462            _this.slides[i].remove();
463        }
464    };
465    _this.getSlide = function (index) {
466        return _this.slides[index];
467    };
468    _this.getLastSlide = function () {
469        return _this.slides[_this.slides.length - 1];
470    };
471    _this.getFirstSlide = function () {
472        return _this.slides[0];
473    };
474
475    //Currently Active Slide
476    _this.activeSlide = function () {
477        return _this.slides[_this.activeIndex];
478    };
479
480    /*=========================
481     Wrapper for Callbacks : Allows additive callbacks via function arrays
482     ===========================*/
483    _this.fireCallback = function () {
484        var callback = arguments[0];
485        if (Object.prototype.toString.call(callback) === '[object Array]') {
486            for (var i = 0; i < callback.length; i++) {
487                if (typeof callback[i] === 'function') {
488                    callback[i](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
489                }
490            }
491        } else if (Object.prototype.toString.call(callback) === '[object String]') {
492            if (params['on' + callback]) _this.fireCallback(params['on' + callback], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
493        } else {
494            callback(arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
495        }
496    };
497    function isArray(obj) {
498        if (Object.prototype.toString.apply(obj) === '[object Array]') return true;
499        return false;
500    }
501
502    /**
503     * Allows user to add callbacks, rather than replace them
504     * @param callback
505     * @param func
506     * @return {*}
507     */
508    _this.addCallback = function (callback, func) {
509        var _this = this, tempFunc;
510        if (_this.params['on' + callback]) {
511            if (isArray(this.params['on' + callback])) {
512                return this.params['on' + callback].push(func);
513            } else if (typeof this.params['on' + callback] === 'function') {
514                tempFunc = this.params['on' + callback];
515                this.params['on' + callback] = [];
516                this.params['on' + callback].push(tempFunc);
517                return this.params['on' + callback].push(func);
518            }
519        } else {
520            this.params['on' + callback] = [];
521            return this.params['on' + callback].push(func);
522        }
523    };
524    _this.removeCallbacks = function (callback) {
525        if (_this.params['on' + callback]) {
526            _this.params['on' + callback] = null;
527        }
528    };
529
530    /*=========================
531      Plugins API
532      ===========================*/
533    var _plugins = [];
534    for (var plugin in _this.plugins) {
535        if (params[plugin]) {
536            var p = _this.plugins[plugin](_this, params[plugin]);
537            if (p) _plugins.push(p);
538        }
539    }
540    _this.callPlugins = function (method, args) {
541        if (!args) args = {};
542        for (var i = 0; i < _plugins.length; i++) {
543            if (method in _plugins[i]) {
544                _plugins[i][method](args);
545            }
546        }
547    };
548
549    /*=========================
550      Windows Phone 8 Fix
551      ===========================*/
552    if ((_this.browser.ie10 || _this.browser.ie11) && !params.onlyExternal) {
553        _this.wrapper.classList.add('swiper-wp8-' + (isH ? 'horizontal' : 'vertical'));
554    }
555
556    /*=========================
557      Free Mode Class
558      ===========================*/
559    if (params.freeMode) {
560        _this.container.className += ' swiper-free-mode';
561    }
562
563    /*==================================================
564        Init/Re-init/Resize Fix
565    ====================================================*/
566    _this.initialized = false;
567    _this.init = function (force, forceCalcSlides) {
568        var _width = _this.h.getWidth(_this.container, false, params.roundLengths);
569        var _height = _this.h.getHeight(_this.container, false, params.roundLengths);
570        if (_width === _this.width && _height === _this.height && !force) return;
571        
572        _this.width = _width;
573        _this.height = _height;
574
575        var slideWidth, slideHeight, slideMaxHeight, wrapperWidth, wrapperHeight, slideLeft;
576        var i; // loop index variable to avoid JSHint W004 / W038
577        containerSize = isH ? _width : _height;
578        var wrapper = _this.wrapper;
579
580        if (force) {
581            _this.calcSlides(forceCalcSlides);
582        }
583
584        if (params.slidesPerView === 'auto') {
585            //Auto mode
586            var slidesWidth = 0;
587            var slidesHeight = 0;
588
589            //Unset Styles
590            if (params.slidesOffset > 0) {
591                wrapper.style.paddingLeft = '';
592                wrapper.style.paddingRight = '';
593                wrapper.style.paddingTop = '';
594                wrapper.style.paddingBottom = '';
595            }
596            wrapper.style.width = '';
597            wrapper.style.height = '';
598            if (params.offsetPxBefore > 0) {
599                if (isH) _this.wrapperLeft = params.offsetPxBefore;
600                else _this.wrapperTop = params.offsetPxBefore;
601            }
602            if (params.offsetPxAfter > 0) {
603                if (isH) _this.wrapperRight = params.offsetPxAfter;
604                else _this.wrapperBottom = params.offsetPxAfter;
605            }
606
607            if (params.centeredSlides) {
608                if (isH) {
609                    _this.wrapperLeft = (containerSize - this.slides[0].getWidth(true, params.roundLengths)) / 2;
610                    _this.wrapperRight = (containerSize - _this.slides[_this.slides.length - 1].getWidth(true, params.roundLengths)) / 2;
611                }
612                else {
613                    _this.wrapperTop = (containerSize - _this.slides[0].getHeight(true, params.roundLengths)) / 2;
614                    _this.wrapperBottom = (containerSize - _this.slides[_this.slides.length - 1].getHeight(true, params.roundLengths)) / 2;
615                }
616            }
617
618            if (isH) {
619                if (_this.wrapperLeft >= 0) wrapper.style.paddingLeft = _this.wrapperLeft + 'px';
620                if (_this.wrapperRight >= 0) wrapper.style.paddingRight = _this.wrapperRight + 'px';
621            }
622            else {
623                if (_this.wrapperTop >= 0) wrapper.style.paddingTop = _this.wrapperTop + 'px';
624                if (_this.wrapperBottom >= 0) wrapper.style.paddingBottom = _this.wrapperBottom + 'px';
625            }
626            slideLeft = 0;
627            var centeredSlideLeft = 0;
628            _this.snapGrid = [];
629            _this.slidesGrid = [];
630
631            slideMaxHeight = 0;
632            for (i = 0; i < _this.slides.length; i++) {
633                slideWidth = _this.slides[i].getWidth(true, params.roundLengths);
634                slideHeight = _this.slides[i].getHeight(true, params.roundLengths);
635                if (params.calculateHeight) {
636                    slideMaxHeight = Math.max(slideMaxHeight, slideHeight);
637                }
638                var _slideSize = isH ? slideWidth : slideHeight;
639                if (params.centeredSlides) {
640                    var nextSlideWidth = i === _this.slides.length - 1 ? 0 : _this.slides[i + 1].getWidth(true, params.roundLengths);
641                    var nextSlideHeight = i === _this.slides.length - 1 ? 0 : _this.slides[i + 1].getHeight(true, params.roundLengths);
642                    var nextSlideSize = isH ? nextSlideWidth : nextSlideHeight;
643                    if (_slideSize > containerSize) {
644                        if (params.slidesPerViewFit) {
645                            _this.snapGrid.push(slideLeft + _this.wrapperLeft);
646                            _this.snapGrid.push(slideLeft + _slideSize - containerSize + _this.wrapperLeft);
647                        }
648                        else {
649                            for (var j = 0; j <= Math.floor(_slideSize / (containerSize + _this.wrapperLeft)); j++) {
650                                if (j === 0) _this.snapGrid.push(slideLeft + _this.wrapperLeft);
651                                else _this.snapGrid.push(slideLeft + _this.wrapperLeft + containerSize * j);
652                            }
653                        }
654                        _this.slidesGrid.push(slideLeft + _this.wrapperLeft);
655                    }
656                    else {
657                        _this.snapGrid.push(centeredSlideLeft);
658                        _this.slidesGrid.push(centeredSlideLeft);
659                    }
660                    centeredSlideLeft += _slideSize / 2 + nextSlideSize / 2;
661                }
662                else {
663                    if (_slideSize > containerSize) {
664                        if (params.slidesPerViewFit) {
665                            _this.snapGrid.push(slideLeft);
666                            _this.snapGrid.push(slideLeft + _slideSize - containerSize);
667                        }
668                        else {
669                            if (containerSize !== 0) {
670                                for (var k = 0; k <= Math.floor(_slideSize / containerSize); k++) {
671                                    _this.snapGrid.push(slideLeft + containerSize * k);
672                                }
673                            }
674                            else {
675                                _this.snapGrid.push(slideLeft);
676                            }
677                        }
678                            
679                    }
680                    else {
681                        _this.snapGrid.push(slideLeft);
682                    }
683                    _this.slidesGrid.push(slideLeft);
684                }
685
686                slideLeft += _slideSize;
687
688                slidesWidth += slideWidth;
689                slidesHeight += slideHeight;
690            }
691            if (params.calculateHeight) _this.height = slideMaxHeight;
692            if (isH) {
693                wrapperSize = slidesWidth + _this.wrapperRight + _this.wrapperLeft;
694                wrapper.style.width = (slidesWidth) + 'px';
695                wrapper.style.height = (_this.height) + 'px';
696            }
697            else {
698                wrapperSize = slidesHeight + _this.wrapperTop + _this.wrapperBottom;
699                wrapper.style.width = (_this.width) + 'px';
700                wrapper.style.height = (slidesHeight) + 'px';
701            }
702
703        }
704        else if (params.scrollContainer) {
705            //Scroll Container
706            wrapper.style.width = '';
707            wrapper.style.height = '';
708            wrapperWidth = _this.slides[0].getWidth(true, params.roundLengths);
709            wrapperHeight = _this.slides[0].getHeight(true, params.roundLengths);
710            wrapperSize = isH ? wrapperWidth : wrapperHeight;
711            wrapper.style.width = wrapperWidth + 'px';
712            wrapper.style.height = wrapperHeight + 'px';
713            slideSize = isH ? wrapperWidth : wrapperHeight;
714
715        }
716        else {
717            //For usual slides
718            if (params.calculateHeight) {
719                slideMaxHeight = 0;
720                wrapperHeight = 0;
721                //ResetWrapperSize
722                if (!isH) _this.container.style.height = '';
723                wrapper.style.height = '';
724
725                for (i = 0; i < _this.slides.length; i++) {
726                    //ResetSlideSize
727                    _this.slides[i].style.height = '';
728                    slideMaxHeight = Math.max(_this.slides[i].getHeight(true), slideMaxHeight);
729                    if (!isH) wrapperHeight += _this.slides[i].getHeight(true);
730                }
731                slideHeight = slideMaxHeight;
732                _this.height = slideHeight;
733
734                if (isH) wrapperHeight = slideHeight;
735                else {
736                    containerSize = slideHeight;
737                    _this.container.style.height = containerSize + 'px';
738                }
739            }
740            else {
741                slideHeight = isH ? _this.height : _this.height / params.slidesPerView;
742                if (params.roundLengths) slideHeight = Math.ceil(slideHeight);
743                wrapperHeight = isH ? _this.height : _this.slides.length * slideHeight;
744            }
745            slideWidth = isH ? _this.width / params.slidesPerView : _this.width;
746            if (params.roundLengths) slideWidth = Math.ceil(slideWidth);
747            wrapperWidth = isH ? _this.slides.length * slideWidth : _this.width;
748            slideSize = isH ? slideWidth : slideHeight;
749
750            if (params.offsetSlidesBefore > 0) {
751                if (isH) _this.wrapperLeft = slideSize * params.offsetSlidesBefore;
752                else _this.wrapperTop = slideSize * params.offsetSlidesBefore;
753            }
754            if (params.offsetSlidesAfter > 0) {
755                if (isH) _this.wrapperRight = slideSize * params.offsetSlidesAfter;
756                else _this.wrapperBottom = slideSize * params.offsetSlidesAfter;
757            }
758            if (params.offsetPxBefore > 0) {
759                if (isH) _this.wrapperLeft = params.offsetPxBefore;
760                else _this.wrapperTop = params.offsetPxBefore;
761            }
762            if (params.offsetPxAfter > 0) {
763                if (isH) _this.wrapperRight = params.offsetPxAfter;
764                else _this.wrapperBottom = params.offsetPxAfter;
765            }
766            if (params.centeredSlides) {
767                if (isH) {
768                    _this.wrapperLeft = (containerSize - slideSize) / 2;
769                    _this.wrapperRight = (containerSize - slideSize) / 2;
770                }
771                else {
772                    _this.wrapperTop = (containerSize - slideSize) / 2;
773                    _this.wrapperBottom = (containerSize - slideSize) / 2;
774                }
775            }
776            if (isH) {
777                if (_this.wrapperLeft > 0) wrapper.style.paddingLeft = _this.wrapperLeft + 'px';
778                if (_this.wrapperRight > 0) wrapper.style.paddingRight = _this.wrapperRight + 'px';
779            }
780            else {
781                if (_this.wrapperTop > 0) wrapper.style.paddingTop = _this.wrapperTop + 'px';
782                if (_this.wrapperBottom > 0) wrapper.style.paddingBottom = _this.wrapperBottom + 'px';
783            }
784
785            wrapperSize = isH ? wrapperWidth + _this.wrapperRight + _this.wrapperLeft : wrapperHeight + _this.wrapperTop + _this.wrapperBottom;
786            if (parseFloat(wrapperWidth) > 0 && (!params.cssWidthAndHeight || params.cssWidthAndHeight === 'height')) {
787                wrapper.style.width = wrapperWidth + 'px';
788            }
789            if (parseFloat(wrapperHeight) > 0 && (!params.cssWidthAndHeight || params.cssWidthAndHeight === 'width')) {
790                wrapper.style.height = wrapperHeight + 'px';
791            }
792            slideLeft = 0;
793            _this.snapGrid = [];
794            _this.slidesGrid = [];
795            for (i = 0; i < _this.slides.length; i++) {
796                _this.snapGrid.push(slideLeft);
797                _this.slidesGrid.push(slideLeft);
798                slideLeft += slideSize;
799                if (parseFloat(slideWidth) > 0 && (!params.cssWidthAndHeight || params.cssWidthAndHeight === 'height')) {
800                    _this.slides[i].style.width = slideWidth + 'px';
801                }
802                if (parseFloat(slideHeight) > 0 && (!params.cssWidthAndHeight || params.cssWidthAndHeight === 'width')) {
803                    _this.slides[i].style.height = slideHeight + 'px';
804                }
805            }
806
807        }
808
809        if (!_this.initialized) {
810            _this.callPlugins('onFirstInit');
811            if (params.onFirstInit) _this.fireCallback(params.onFirstInit, _this);
812        }
813        else {
814            _this.callPlugins('onInit');
815            if (params.onInit) _this.fireCallback(params.onInit, _this);
816        }
817        _this.initialized = true;
818    };
819
820    _this.reInit = function (forceCalcSlides) {
821        _this.init(true, forceCalcSlides);
822    };
823
824    _this.resizeFix = function (reInit) {
825        _this.callPlugins('beforeResizeFix');
826
827        _this.init(params.resizeReInit || reInit);
828
829        // swipe to active slide in fixed mode
830        if (!params.freeMode) {
831            _this.swipeTo((params.loop ? _this.activeLoopIndex : _this.activeIndex), 0, false);
832            // Fix autoplay
833            if (params.autoplay) {
834                if (_this.support.transitions && typeof autoplayTimeoutId !== 'undefined') {
835                    if (typeof autoplayTimeoutId !== 'undefined') {
836                        clearTimeout(autoplayTimeoutId);
837                        autoplayTimeoutId = undefined;
838                        _this.startAutoplay();
839                    }
840                }
841                else {
842                    if (typeof autoplayIntervalId !== 'undefined') {
843                        clearInterval(autoplayIntervalId);
844                        autoplayIntervalId = undefined;
845                        _this.startAutoplay();
846                    }
847                }
848            }
849        }
850        // move wrapper to the beginning in free mode
851        else if (_this.getWrapperTranslate() < -maxWrapperPosition()) {
852            _this.setWrapperTransition(0);
853            _this.setWrapperTranslate(-maxWrapperPosition());
854        }
855
856        _this.callPlugins('afterResizeFix');
857    };
858
859    /*==========================================
860        Max and Min Positions
861    ============================================*/
862    function maxWrapperPosition() {
863        var a = (wrapperSize - containerSize);
864        if (params.freeMode) {
865            a = wrapperSize - containerSize;
866        }
867        // if (params.loop) a -= containerSize;
868        if (params.slidesPerView > _this.slides.length && !params.centeredSlides) {
869            a = 0;
870        }
871        if (a < 0) a = 0;
872        return a;
873    }
874
875    /*==========================================
876        Event Listeners
877    ============================================*/
878    function initEvents() {
879        var bind = _this.h.addEventListener;
880        var eventTarget = params.eventTarget === 'wrapper' ? _this.wrapper : _this.container;
881        //Touch Events
882        if (! (_this.browser.ie10 || _this.browser.ie11)) {
883            if (_this.support.touch) {
884                bind(eventTarget, 'touchstart', onTouchStart);
885                bind(eventTarget, 'touchmove', onTouchMove);
886                bind(eventTarget, 'touchend', onTouchEnd);
887            }
888            if (params.simulateTouch) {
889                bind(eventTarget, 'mousedown', onTouchStart);
890                bind(document, 'mousemove', onTouchMove);
891                bind(document, 'mouseup', onTouchEnd);
892            }
893        }
894        else {
895            bind(eventTarget, _this.touchEvents.touchStart, onTouchStart);
896            bind(document, _this.touchEvents.touchMove, onTouchMove);
897            bind(document, _this.touchEvents.touchEnd, onTouchEnd);
898        }
899
900        //Resize Event
901        if (params.autoResize) {
902            bind(window, 'resize', _this.resizeFix);
903        }
904        //Slide Events
905        addSlideEvents();
906        //Mousewheel
907        _this._wheelEvent = false;
908        if (params.mousewheelControl) {
909            if (document.onmousewheel !== undefined) {
910                _this._wheelEvent = 'mousewheel';
911            }
912            if (!_this._wheelEvent) {
913                try {
914                    new WheelEvent('wheel');
915                    _this._wheelEvent = 'wheel';
916                } catch (e) {}
917            }
918            if (!_this._wheelEvent) {
919                _this._wheelEvent = 'DOMMouseScroll';
920            }
921            if (_this._wheelEvent) {
922                bind(_this.container, _this._wheelEvent, handleMousewheel);
923            }
924        }
925
926        //Keyboard
927        function _loadImage(src) {
928            var image = new Image();
929            image.onload = function () {
930                if (typeof _this === 'undefined' || _this === null) return;
931                if (_this.imagesLoaded !== undefined) _this.imagesLoaded++;
932                if (_this.imagesLoaded === _this.imagesToLoad.length) {
933                    _this.reInit();
934                    if (params.onImagesReady) _this.fireCallback(params.onImagesReady, _this);
935                }
936            };
937            image.src = src;
938        }
939
940        if (params.keyboardControl) {
941            bind(document, 'keydown', handleKeyboardKeys);
942        }
943        if (params.updateOnImagesReady) {
944            _this.imagesToLoad = $$('img', _this.container);
945
946            for (var i = 0; i < _this.imagesToLoad.length; i++) {
947                _loadImage(_this.imagesToLoad[i].getAttribute('src'));
948            }
949        }
950    }
951
952    //Remove Event Listeners
953    _this.destroy = function () {
954        var unbind = _this.h.removeEventListener;
955        var eventTarget = params.eventTarget === 'wrapper' ? _this.wrapper : _this.container;
956        //Touch Events
957        if (! (_this.browser.ie10 || _this.browser.ie11)) {
958            if (_this.support.touch) {
959                unbind(eventTarget, 'touchstart', onTouchStart);
960                unbind(eventTarget, 'touchmove', onTouchMove);
961                unbind(eventTarget, 'touchend', onTouchEnd);
962            }
963            if (params.simulateTouch) {
964                unbind(eventTarget, 'mousedown', onTouchStart);
965                unbind(document, 'mousemove', onTouchMove);
966                unbind(document, 'mouseup', onTouchEnd);
967            }
968        }
969        else {
970            unbind(eventTarget, _this.touchEvents.touchStart, onTouchStart);
971            unbind(document, _this.touchEvents.touchMove, onTouchMove);
972            unbind(document, _this.touchEvents.touchEnd, onTouchEnd);
973        }
974
975        //Resize Event
976        if (params.autoResize) {
977            unbind(window, 'resize', _this.resizeFix);
978        }
979
980        //Init Slide Events
981        removeSlideEvents();
982
983        //Pagination
984        if (params.paginationClickable) {
985            removePaginationEvents();
986        }
987
988        //Mousewheel
989        if (params.mousewheelControl && _this._wheelEvent) {
990            unbind(_this.container, _this._wheelEvent, handleMousewheel);
991        }
992
993        //Keyboard
994        if (params.keyboardControl) {
995            unbind(document, 'keydown', handleKeyboardKeys);
996        }
997
998        //Stop autoplay
999        if (params.autoplay) {
1000            _this.stopAutoplay();
1001        }
1002        _this.callPlugins('onDestroy');
1003
1004        //Destroy variable
1005        _this = null;
1006    };
1007
1008    function addSlideEvents() {
1009        var bind = _this.h.addEventListener,
1010            i;
1011
1012        //Prevent Links Events
1013        if (params.preventLinks) {
1014            var links = $$('a', _this.container);
1015            for (i = 0; i < links.length; i++) {
1016                bind(links[i], 'click', preventClick);
1017            }
1018        }
1019        //Release Form Elements
1020        if (params.releaseFormElements) {
1021            var formElements = $$('input, textarea, select', _this.container);
1022            for (i = 0; i < formElements.length; i++) {
1023                bind(formElements[i], _this.touchEvents.touchStart, releaseForms, true);
1024            }
1025        }
1026
1027        //Slide Clicks & Touches
1028        if (params.onSlideClick) {
1029            for (i = 0; i < _this.slides.length; i++) {
1030                bind(_this.slides[i], 'click', slideClick);
1031            }
1032        }
1033        if (params.onSlideTouch) {
1034            for (i = 0; i < _this.slides.length; i++) {
1035                bind(_this.slides[i], _this.touchEvents.touchStart, slideTouch);
1036            }
1037        }
1038    }
1039    function removeSlideEvents() {
1040        var unbind = _this.h.removeEventListener,
1041            i;
1042
1043        //Slide Clicks & Touches
1044        if (params.onSlideClick) {
1045            for (i = 0; i < _this.slides.length; i++) {
1046                unbind(_this.slides[i], 'click', slideClick);
1047            }
1048        }
1049        if (params.onSlideTouch) {
1050            for (i = 0; i < _this.slides.length; i++) {
1051                unbind(_this.slides[i], _this.touchEvents.touchStart, slideTouch);
1052            }
1053        }
1054        //Release Form Elements
1055        if (params.releaseFormElements) {
1056            var formElements = $$('input, textarea, select', _this.container);
1057            for (i = 0; i < formElements.length; i++) {
1058                unbind(formElements[i], _this.touchEvents.touchStart, releaseForms, true);
1059            }
1060        }
1061        //Prevent Links Events
1062        if (params.preventLinks) {
1063            var links = $$('a', _this.container);
1064            for (i = 0; i < links.length; i++) {
1065                unbind(links[i], 'click', preventClick);
1066            }
1067        }
1068    }
1069    /*==========================================
1070        Keyboard Control
1071    ============================================*/
1072    function handleKeyboardKeys(e) {
1073        var kc = e.keyCode || e.charCode;
1074        if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) return;
1075        if (kc === 37 || kc === 39 || kc === 38 || kc === 40) {
1076            var inView = false;
1077            //Check that swiper should be inside of visible area of window
1078            var swiperOffset = _this.h.getOffset(_this.container);
1079            var scrollLeft = _this.h.windowScroll().left;
1080            var scrollTop = _this.h.windowScroll().top;
1081            var windowWidth = _this.h.windowWidth();
1082            var windowHeight = _this.h.windowHeight();
1083            var swiperCoord = [
1084                [swiperOffset.left, swiperOffset.top],
1085                [swiperOffset.left + _this.width, swiperOffset.top],
1086                [swiperOffset.left, swiperOffset.top + _this.height],
1087                [swiperOffset.left + _this.width, swiperOffset.top + _this.height]
1088            ];
1089            for (var i = 0; i < swiperCoord.length; i++) {
1090                var point = swiperCoord[i];
1091                if (
1092                    point[0] >= scrollLeft && point[0] <= scrollLeft + windowWidth &&
1093                    point[1] >= scrollTop && point[1] <= scrollTop + windowHeight
1094                ) {
1095                    inView = true;
1096                }
1097
1098            }
1099            if (!inView) return;
1100        }
1101        if (isH) {
1102            if (kc === 37 || kc === 39) {
1103                if (e.preventDefault) e.preventDefault();
1104                else e.returnValue = false;
1105            }
1106            if (kc === 39) _this.swipeNext();
1107            if (kc === 37) _this.swipePrev();
1108        }
1109        else {
1110            if (kc === 38 || kc === 40) {
1111                if (e.preventDefault) e.preventDefault();
1112                else e.returnValue = false;
1113            }
1114            if (kc === 40) _this.swipeNext();
1115            if (kc === 38) _this.swipePrev();
1116        }
1117    }
1118
1119    _this.disableKeyboardControl = function () {
1120        params.keyboardControl = false;
1121        _this.h.removeEventListener(document, 'keydown', handleKeyboardKeys);
1122    };
1123
1124    _this.enableKeyboardControl = function () {
1125        params.keyboardControl = true;
1126        _this.h.addEventListener(document, 'keydown', handleKeyboardKeys);
1127    };
1128
1129    /*==========================================
1130        Mousewheel Control
1131    ============================================*/
1132    var lastScrollTime = (new Date()).getTime();
1133    function handleMousewheel(e) {
1134        var we = _this._wheelEvent;
1135        var delta = 0;
1136
1137        //Opera & IE
1138        if (e.detail) delta = -e.detail;
1139        //WebKits
1140        else if (we === 'mousewheel') {
1141            if (params.mousewheelControlForceToAxis) {
1142                if (isH) {
1143                    if (Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY)) delta = e.wheelDeltaX;
1144                    else return;
1145                }
1146                else {
1147                    if (Math.abs(e.wheelDeltaY) > Math.abs(e.wheelDeltaX)) delta = e.wheelDeltaY;
1148                    else return;
1149                }
1150            }
1151            else {
1152                delta = e.wheelDelta;
1153            }
1154        }
1155        //Old FireFox
1156        else if (we === 'DOMMouseScroll') delta = -e.detail;
1157        //New FireFox
1158        else if (we === 'wheel') {
1159            if (params.mousewheelControlForceToAxis) {
1160                if (isH) {
1161                    if (Math.abs(e.deltaX) > Math.abs(e.deltaY)) delta = -e.deltaX;
1162                    else return;
1163                }
1164                else {
1165                    if (Math.abs(e.deltaY) > Math.abs(e.deltaX)) delta = -e.deltaY;
1166                    else return;
1167                }
1168            }
1169            else {
1170                delta = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? - e.deltaX : - e.deltaY;
1171            }
1172        }
1173
1174        function normalizeWheelSpeed(event) {
1175            var normalized;
1176            if (event.wheelDelta) {
1177                normalized = (event.wheelDelta % 120 - 0) === -0 ? event.wheelDelta / 120 : event.wheelDelta / 12;
1178            } else {
1179                var rawAmmount = event.deltaY ? event.deltaY : event.detail;
1180                normalized = rawAmmount % 3 ? (rawAmmount % 1 ? rawAmmount * 10 : rawAmmount) : rawAmmount / 3;
1181            }
1182            return normalized;
1183        }
1184
1185        // console.log(we, delta, normalizeWheelSpeed(e));
1186        if (!params.freeMode) {
1187            if ((new Date()).getTime() - lastScrollTime > 60) {
1188                if (delta < 0) _this.swipeNext();
1189                else _this.swipePrev();
1190            }
1191            lastScrollTime = (new Date()).getTime();
1192
1193        }
1194        else {
1195            //Freemode or scrollContainer:
1196            var position = _this.getWrapperTranslate() + delta;
1197
1198            if (position > 0) position = 0;
1199            if (position < -maxWrapperPosition()) position = -maxWrapperPosition();
1200
1201            _this.setWrapperTransition(0);
1202            _this.setWrapperTranslate(position);
1203            _this.updateActiveSlide(position);
1204
1205            // Return page scroll on edge positions
1206            if (position === 0 || position === -maxWrapperPosition()) return;
1207        }
1208        if (params.autoplay) _this.stopAutoplay(true);
1209
1210        if (e.preventDefault) e.preventDefault();
1211        else e.returnValue = false;
1212        return false;
1213    }
1214    _this.disableMousewheelControl = function () {
1215        if (!_this._wheelEvent) return false;
1216        params.mousewheelControl = false;
1217        _this.h.removeEventListener(_this.container, _this._wheelEvent, handleMousewheel);
1218        return true;
1219    };
1220
1221    _this.enableMousewheelControl = function () {
1222        if (!_this._wheelEvent) return false;
1223        params.mousewheelControl = true;
1224        _this.h.addEventListener(_this.container, _this._wheelEvent, handleMousewheel);
1225        return true;
1226    };
1227
1228    /*=========================
1229      Grab Cursor
1230      ===========================*/
1231    if (params.grabCursor) {
1232        var containerStyle = _this.container.style;
1233        containerStyle.cursor = 'move';
1234        containerStyle.cursor = 'grab';
1235        containerStyle.cursor = '-moz-grab';
1236        containerStyle.cursor = '-webkit-grab';
1237    }
1238
1239    /*=========================
1240      Slides Events Handlers
1241      ===========================*/
1242
1243    _this.allowSlideClick = true;
1244    function slideClick(event) {
1245        if (_this.allowSlideClick) {
1246            setClickedSlide(event);
1247            _this.fireCallback(params.onSlideClick, _this, event);
1248        }
1249    }
1250
1251    function slideTouch(event) {
1252        setClickedSlide(event);
1253        _this.fireCallback(params.onSlideTouch, _this, event);
1254    }
1255
1256    function setClickedSlide(event) {
1257
1258        // IE 6-8 support
1259        if (!event.currentTarget) {
1260            var element = event.srcElement;
1261            do {
1262                if (element.className.indexOf(params.slideClass) > -1) {
1263                    break;
1264                }
1265                element = element.parentNode;
1266            } while (element);
1267            _this.clickedSlide = element;
1268        }
1269        else {
1270            _this.clickedSlide = event.currentTarget;
1271        }
1272
1273        _this.clickedSlideIndex     = _this.slides.indexOf(_this.clickedSlide);
1274        _this.clickedSlideLoopIndex = _this.clickedSlideIndex - (_this.loopedSlides || 0);
1275    }
1276
1277    _this.allowLinks = true;
1278    function preventClick(e) {
1279        if (!_this.allowLinks) {
1280            if (e.preventDefault) e.preventDefault();
1281            else e.returnValue = false;
1282            if (params.preventLinksPropagation && 'stopPropagation' in e) {
1283                e.stopPropagation();
1284            }
1285            return false;
1286        }
1287    }
1288    function releaseForms(e) {
1289        if (e.stopPropagation) e.stopPropagation();
1290        else e.returnValue = false;
1291        return false;
1292
1293    }
1294
1295    /*==================================================
1296        Event Handlers
1297    ====================================================*/
1298    var isTouchEvent = false;
1299    var allowThresholdMove;
1300    var allowMomentumBounce = true;
1301    function onTouchStart(event) {
1302        if (params.preventLinks) _this.allowLinks = true;
1303        //Exit if slider is already was touched
1304        if (_this.isTouched || params.onlyExternal) {
1305            return false;
1306        }
1307
1308        // Blur active elements
1309        var eventTarget = event.target || event.srcElement;
1310        if (document.activeElement) {
1311            if (document.activeElement !== eventTarget) document.activeElement.blur();
1312        }
1313
1314        // Form tag names
1315        var formTagNames = ('input select textarea').split(' ');
1316
1317        // Check for no swiping
1318        if (params.noSwiping && (eventTarget) && noSwipingSlide(eventTarget)) return false;
1319        allowMomentumBounce = false;
1320        //Check For Nested Swipers
1321        _this.isTouched = true;
1322        isTouchEvent = event.type === 'touchstart';
1323
1324        // prevent user enter with right and the swiper move (needs isTouchEvent)
1325        if (!isTouchEvent && 'which' in event && event.which === 3) return false;
1326
1327        if (!isTouchEvent || event.targetTouches.length === 1) {
1328            _this.callPlugins('onTouchStartBegin');
1329            if (!isTouchEvent && !_this.isAndroid && formTagNames.indexOf(eventTarget.tagName.toLowerCase()) < 0) {
1330
1331                if (event.preventDefault) event.preventDefault();
1332                else event.returnValue = false;
1333            }
1334
1335            var pageX = isTouchEvent ? event.targetTouches[0].pageX : (event.pageX || event.clientX);
1336            var pageY = isTouchEvent ? event.targetTouches[0].pageY : (event.pageY || event.clientY);
1337
1338            //Start Touches to check the scrolling
1339            _this.touches.startX = _this.touches.currentX = pageX;
1340            _this.touches.startY = _this.touches.currentY = pageY;
1341
1342            _this.touches.start = _this.touches.current = isH ? pageX : pageY;
1343
1344            //Set Transition Time to 0
1345            _this.setWrapperTransition(0);
1346
1347            //Get Start Translate Position
1348            _this.positions.start = _this.positions.current = _this.getWrapperTranslate();
1349
1350            //Set Transform
1351            _this.setWrapperTranslate(_this.positions.start);
1352
1353            //TouchStartTime
1354            _this.times.start = (new Date()).getTime();
1355
1356            //Unset Scrolling
1357            isScrolling = undefined;
1358
1359            //Set Treshold
1360            if (params.moveStartThreshold > 0) {
1361                allowThresholdMove = false;
1362            }
1363
1364            //CallBack
1365            if (params.onTouchStart) _this.fireCallback(params.onTouchStart, _this, event);
1366            _this.callPlugins('onTouchStartEnd');
1367
1368        }
1369    }
1370    var velocityPrevPosition, velocityPrevTime;
1371    function onTouchMove(event) {
1372        // If slider is not touched - exit
1373        if (!_this.isTouched || params.onlyExternal) return;
1374        if (isTouchEvent && event.type === 'mousemove') return;
1375
1376        var pageX = isTouchEvent ? event.targetTouches[0].pageX : (event.pageX || event.clientX);
1377        var pageY = isTouchEvent ? event.targetTouches[0].pageY : (event.pageY || event.clientY);
1378
1379        //check for scrolling
1380        if (typeof isScrolling === 'undefined' && isH) {
1381            isScrolling = !!(isScrolling || Math.abs(pageY - _this.touches.startY) > Math.abs(pageX - _this.touches.startX));
1382        }
1383        if (typeof isScrolling === 'undefined' && !isH) {
1384            isScrolling = !!(isScrolling || Math.abs(pageY - _this.touches.startY) < Math.abs(pageX - _this.touches.startX));
1385        }
1386        if (isScrolling) {
1387            _this.isTouched = false;
1388            return;
1389        }
1390
1391        // One way swipes
1392        if (isH) {
1393            if ((!params.swipeToNext && pageX < _this.touches.startX) || ((!params.swipeToPrev && pageX > _this.touches.startX))) {
1394                return;
1395            }
1396        }
1397        else {
1398            if ((!params.swipeToNext && pageY < _this.touches.startY) || ((!params.swipeToPrev && pageY > _this.touches.startY))) {
1399                return;
1400            }
1401        }
1402
1403        //Check For Nested Swipers
1404        if (event.assignedToSwiper) {
1405            _this.isTouched = false;
1406            return;
1407        }
1408        event.assignedToSwiper = true;
1409
1410        //Block inner links
1411        if (params.preventLinks) {
1412            _this.allowLinks = false;
1413        }
1414        if (params.onSlideClick) {
1415            _this.allowSlideClick = false;
1416        }
1417
1418        //Stop AutoPlay if exist
1419        if (params.autoplay) {
1420            _this.stopAutoplay(true);
1421        }
1422        if (!isTouchEvent || event.touches.length === 1) {
1423
1424            //Moved Flag
1425            if (!_this.isMoved) {
1426                _this.callPlugins('onTouchMoveStart');
1427
1428                if (params.loop) {
1429                    _this.fixLoop();
1430                    _this.positions.start = _this.getWrapperTranslate();
1431                }
1432                if (params.onTouchMoveStart) _this.fireCallback(params.onTouchMoveStart, _this);
1433            }
1434            _this.isMoved = true;
1435
1436            // cancel event
1437            if (event.preventDefault) event.preventDefault();
1438            else event.returnValue = false;
1439
1440            _this.touches.current = isH ? pageX : pageY;
1441
1442            _this.positions.current = (_this.touches.current - _this.touches.start) * params.touchRatio + _this.positions.start;
1443
1444            //Resistance Callbacks
1445            if (_this.positions.current > 0 && params.onResistanceBefore) {
1446                _this.fireCallback(params.onResistanceBefore, _this, _this.positions.current);
1447            }
1448            if (_this.positions.current < -maxWrapperPosition() && params.onResistanceAfter) {
1449                _this.fireCallback(params.onResistanceAfter, _this, Math.abs(_this.positions.current + maxWrapperPosition()));
1450            }
1451            //Resistance
1452            if (params.resistance && params.resistance !== '100%') {
1453                var resistance;
1454                //Resistance for Negative-Back sliding
1455                if (_this.positions.current > 0) {
1456                    resistance = 1 - _this.positions.current / containerSize / 2;
1457                    if (resistance < 0.5)
1458                        _this.positions.current = (containerSize / 2);
1459                    else
1460                        _this.positions.current = _this.positions.current * resistance;
1461                }
1462                //Resistance for After-End Sliding
1463                if (_this.positions.current < -maxWrapperPosition()) {
1464
1465                    var diff = (_this.touches.current - _this.touches.start) * params.touchRatio + (maxWrapperPosition() + _this.positions.start);
1466                    resistance = (containerSize + diff) / (containerSize);
1467                    var newPos = _this.positions.current - diff * (1 - resistance) / 2;
1468                    var stopPos = -maxWrapperPosition() - containerSize / 2;
1469
1470                    if (newPos < stopPos || resistance <= 0)
1471                        _this.positions.current = stopPos;
1472                    else
1473                        _this.positions.current = newPos;
1474                }
1475            }
1476            if (params.resistance && params.resistance === '100%') {
1477                //Resistance for Negative-Back sliding
1478                if (_this.positions.current > 0 && !(params.freeMode && !params.freeModeFluid)) {
1479                    _this.positions.current = 0;
1480                }
1481                //Resistance for After-End Sliding
1482                if (_this.positions.current < -maxWrapperPosition() && !(params.freeMode && !params.freeModeFluid)) {
1483                    _this.positions.current = -maxWrapperPosition();
1484                }
1485            }
1486            //Move Slides
1487            if (!params.followFinger) return;
1488
1489            if (!params.moveStartThreshold) {
1490                _this.setWrapperTranslate(_this.positions.current);
1491            }
1492            else {
1493                if (Math.abs(_this.touches.current - _this.touches.start) > params.moveStartThreshold || allowThresholdMove) {
1494                    if (!allowThresholdMove) {
1495                        allowThresholdMove = true;
1496                        _this.touches.start = _this.touches.current;
1497                        return;
1498                    }
1499                    _this.setWrapperTranslate(_this.positions.current);
1500                }
1501                else {
1502                    _this.positions.current = _this.positions.start;
1503                }
1504            }
1505
1506            if (params.freeMode || params.watchActiveIndex) {
1507                _this.updateActiveSlide(_this.positions.current);
1508            }
1509
1510            //Grab Cursor
1511            if (params.grabCursor) {
1512                _this.container.style.cursor = 'move';
1513                _this.container.style.cursor = 'grabbing';
1514                _this.container.style.cursor = '-moz-grabbin';
1515                _this.container.style.cursor = '-webkit-grabbing';
1516            }
1517            //Velocity
1518            if (!velocityPrevPosition) velocityPrevPosition = _this.touches.current;
1519            if (!velocityPrevTime) velocityPrevTime = (new Date()).getTime();
1520            _this.velocity = (_this.touches.current - velocityPrevPosition) / ((new Date()).getTime() - velocityPrevTime) / 2;
1521            if (Math.abs(_this.touches.current - velocityPrevPosition) < 2) _this.velocity = 0;
1522            velocityPrevPosition = _this.touches.current;
1523            velocityPrevTime = (new Date()).getTime();
1524            //Callbacks
1525            _this.callPlugins('onTouchMoveEnd');
1526            if (params.onTouchMove) _this.fireCallback(params.onTouchMove, _this, event);
1527
1528            return false;
1529        }
1530    }
1531    function onTouchEnd(event) {
1532        //Check For scrolling
1533        if (isScrolling) {
1534            _this.swipeReset();
1535        }
1536        // If slider is not touched exit
1537        if (params.onlyExternal || !_this.isTouched) return;
1538        _this.isTouched = false;
1539
1540        //Return Grab Cursor
1541        if (params.grabCursor) {
1542            _this.container.style.cursor = 'move';
1543            _this.container.style.cursor = 'grab';
1544            _this.container.style.cursor = '-moz-grab';
1545            _this.container.style.cursor = '-webkit-grab';
1546        }
1547
1548        //Check for Current Position
1549        if (!_this.positions.current && _this.positions.current !== 0) {
1550            _this.positions.current = _this.positions.start;
1551        }
1552
1553        //For case if slider touched but not moved
1554        if (params.followFinger) {
1555            _this.setWrapperTranslate(_this.positions.current);
1556        }
1557
1558        // TouchEndTime
1559        _this.times.end = (new Date()).getTime();
1560
1561        //Difference
1562        _this.touches.diff = _this.touches.current - _this.touches.start;
1563        _this.touches.abs = Math.abs(_this.touches.diff);
1564
1565        _this.positions.diff = _this.positions.current - _this.positions.start;
1566        _this.positions.abs = Math.abs(_this.positions.diff);
1567
1568        var diff = _this.positions.diff;
1569        var diffAbs = _this.positions.abs;
1570        var timeDiff = _this.times.end - _this.times.start;
1571
1572        if (diffAbs < 5 && (timeDiff) < 300 && _this.allowLinks === false) {
1573            if (!params.freeMode && diffAbs !== 0) _this.swipeReset();
1574            //Release inner links
1575            if (params.preventLinks) {
1576                _this.allowLinks = true;
1577            }
1578            if (params.onSlideClick) {
1579                _this.allowSlideClick = true;
1580            }
1581        }
1582
1583        setTimeout(function () {
1584            //Release inner links
1585            if (typeof _this === 'undefined' || _this === null) return;
1586            if (params.preventLinks) {
1587                _this.allowLinks = true;
1588            }
1589            if (params.onSlideClick) {
1590                _this.allowSlideClick = true;
1591            }
1592        }, 100);
1593
1594        var maxPosition = maxWrapperPosition();
1595
1596        //Not moved or Prevent Negative Back Sliding/After-End Sliding
1597        if (!_this.isMoved && params.freeMode) {
1598            _this.isMoved = false;
1599            if (params.onTouchEnd) _this.fireCallback(params.onTouchEnd, _this, event);
1600            _this.callPlugins('onTouchEnd');
1601            return;
1602        }
1603        if (!_this.isMoved || _this.positions.current > 0 || _this.positions.current < -maxPosition) {
1604            _this.swipeReset();
1605            if (params.onTouchEnd) _this.fireCallback(params.onTouchEnd, _this, event);
1606            _this.callPlugins('onTouchEnd');
1607            return;
1608        }
1609
1610        _this.isMoved = false;
1611
1612        //Free Mode
1613        if (params.freeMode) {
1614            if (params.freeModeFluid) {
1615                var momentumDuration = 1000 * params.momentumRatio;
1616                var momentumDistance = _this.velocity * momentumDuration;
1617                var newPosition = _this.positions.current + momentumDistance;
1618                var doBounce = false;
1619                var afterBouncePosition;
1620                var bounceAmount = Math.abs(_this.velocity) * 20 * params.momentumBounceRatio;
1621                if (newPosition < -maxPosition) {
1622                    if (params.momentumBounce && _this.support.transitions) {
1623                        if (newPosition + maxPosition < -bounceAmount) newPosition = -maxPosition - bounceAmount;
1624                        afterBouncePosition = -maxPosition;
1625                        doBounce = true;
1626                        allowMomentumBounce = true;
1627                    }
1628                    else newPosition = -maxPosition;
1629                }
1630                if (newPosition > 0) {
1631                    if (params.momentumBounce && _this.support.transitions) {
1632                        if (newPosition > bounceAmount) newPosition = bounceAmount;
1633                        afterBouncePosition = 0;
1634                        doBounce = true;
1635                        allowMomentumBounce = true;
1636                    }
1637                    else newPosition = 0;
1638                }
1639                //Fix duration
1640                if (_this.velocity !== 0) momentumDuration = Math.abs((newPosition - _this.positions.current) / _this.velocity);
1641
1642                _this.setWrapperTranslate(newPosition);
1643
1644                _this.setWrapperTransition(momentumDuration);
1645
1646                if (params.momentumBounce && doBounce) {
1647                    _this.wrapperTransitionEnd(function () {
1648                        if (!allowMomentumBounce) return;
1649                        if (params.onMomentumBounce) _this.fireCallback(params.onMomentumBounce, _this);
1650                        _this.callPlugins('onMomentumBounce');
1651
1652                        _this.setWrapperTranslate(afterBouncePosition);
1653                        _this.setWrapperTransition(300);
1654                    });
1655                }
1656
1657                _this.updateActiveSlide(newPosition);
1658            }
1659            if (!params.freeModeFluid || timeDiff >= 300) _this.updateActiveSlide(_this.positions.current);
1660
1661            if (params.onTouchEnd) _this.fireCallback(params.onTouchEnd, _this, event);
1662            _this.callPlugins('onTouchEnd');
1663            return;
1664        }
1665
1666        //Direction
1667        direction = diff < 0 ? 'toNext' : 'toPrev';
1668
1669        //Short Touches
1670        if (direction === 'toNext' && (timeDiff <= 300)) {
1671            if (diffAbs < 30 || !params.shortSwipes) _this.swipeReset();
1672            else _this.swipeNext(true);
1673        }
1674
1675        if (direction === 'toPrev' && (timeDiff <= 300)) {
1676            if (diffAbs < 30 || !params.shortSwipes) _this.swipeReset();
1677            else _this.swipePrev(true);
1678        }
1679
1680        //Long Touches
1681        var targetSlideSize = 0;
1682        if (params.slidesPerView === 'auto') {
1683            //Define current slide's width
1684            var currentPosition = Math.abs(_this.getWrapperTranslate());
1685            var slidesOffset = 0;
1686            var _slideSize;
1687            for (var i = 0; i < _this.slides.length; i++) {
1688                _slideSize = isH ? _this.slides[i].getWidth(true, params.roundLengths) : _this.slides[i].getHeight(true, params.roundLengths);
1689                slidesOffset += _slideSize;
1690                if (slidesOffset > currentPosition) {
1691                    targetSlideSize = _slideSize;
1692                    break;
1693                }
1694            }
1695            if (targetSlideSize > containerSize) targetSlideSize = containerSize;
1696        }
1697        else {
1698            targetSlideSize = slideSize * params.slidesPerView;
1699        }
1700        if (direction === 'toNext' && (timeDiff > 300)) {
1701            if (diffAbs >= targetSlideSize * params.longSwipesRatio) {
1702                _this.swipeNext(true);
1703            }
1704            else {
1705                _this.swipeReset();
1706            }
1707        }
1708        if (direction === 'toPrev' && (timeDiff > 300)) {
1709            if (diffAbs >= targetSlideSize * params.longSwipesRatio) {
1710                _this.swipePrev(true);
1711            }
1712            else {
1713                _this.swipeReset();
1714            }
1715        }
1716        if (params.onTouchEnd) _this.fireCallback(params.onTouchEnd, _this, event);
1717        _this.callPlugins('onTouchEnd');
1718    }
1719
1720
1721    /*==================================================
1722        noSwiping Bubble Check by Isaac Strack
1723    ====================================================*/
1724    function noSwipingSlide(el) {
1725        /*This function is specifically designed to check the parent elements for the noSwiping class, up to the wrapper.
1726        We need to check parents because while onTouchStart bubbles, _this.isTouched is checked in onTouchStart, which stops the bubbling.
1727        So, if a text box, for example, is the initial target, and the parent slide container has the noSwiping class, the _this.isTouched
1728        check will never find it, and what was supposed to be noSwiping is able to be swiped.
1729        This function will iterate up and check for the noSwiping class in parents, up through the wrapperClass.*/
1730
1731        // First we create a truthy variable, which is that swiping is allowd (noSwiping = false)
1732        var noSwiping = false;
1733
1734        // Now we iterate up (parentElements) until we reach the node with the wrapperClass.
1735        do {
1736
1737            // Each time, we check to see if there's a 'swiper-no-swiping' class (noSwipingClass).
1738            if (el.className.indexOf(params.noSwipingClass) > -1)
1739            {
1740                noSwiping = true; // If there is, we set noSwiping = true;
1741            }
1742
1743            el = el.parentElement;  // now we iterate up (parent node)
1744
1745        } while (!noSwiping && el.parentElement && el.className.indexOf(params.wrapperClass) === -1); // also include el.parentElement truthy, just in case.
1746
1747        // because we didn't check the wrapper itself, we do so now, if noSwiping is false:
1748        if (!noSwiping && el.className.indexOf(params.wrapperClass) > -1 && el.className.indexOf(params.noSwipingClass) > -1)
1749            noSwiping = true; // if the wrapper has the noSwipingClass, we set noSwiping = true;
1750
1751        return noSwiping;
1752    }
1753
1754    function addClassToHtmlString(klass, outerHtml) {
1755        var par = document.createElement('div');
1756        var child;
1757
1758        par.innerHTML = outerHtml;
1759        child = par.firstChild;
1760        child.className += ' ' + klass;
1761
1762        return child.outerHTML;
1763    }
1764
1765
1766    /*==================================================
1767        Swipe Functions
1768    ====================================================*/
1769    _this.swipeNext = function (internal) {
1770        if (!internal && params.loop) _this.fixLoop();
1771        if (!internal && params.autoplay) _this.stopAutoplay(true);
1772        _this.callPlugins('onSwipeNext');
1773        var currentPosition = _this.getWrapperTranslate();
1774        var newPosition = currentPosition;
1775        if (params.slidesPerView === 'auto') {
1776            for (var i = 0; i < _this.snapGrid.length; i++) {
1777                if (-currentPosition >= _this.snapGrid[i] && -currentPosition < _this.snapGrid[i + 1]) {
1778                    newPosition = -_this.snapGrid[i + 1];
1779                    break;
1780                }
1781            }
1782        }
1783        else {
1784            var groupSize = slideSize * params.slidesPerGroup;
1785            newPosition = -(Math.floor(Math.abs(currentPosition) / Math.floor(groupSize)) * groupSize + groupSize);
1786        }
1787        if (newPosition < -maxWrapperPosition()) {
1788            newPosition = -maxWrapperPosition();
1789        }
1790        if (newPosition === currentPosition) return false;
1791        swipeToPosition(newPosition, 'next');
1792        return true;
1793    };
1794    _this.swipePrev = function (internal) {
1795        if (!internal && params.loop) _this.fixLoop();
1796        if (!internal && params.autoplay) _this.stopAutoplay(true);
1797        _this.callPlugins('onSwipePrev');
1798
1799        var currentPosition = Math.ceil(_this.getWrapperTranslate());
1800        var newPosition;
1801        if (params.slidesPerView === 'auto') {
1802            newPosition = 0;
1803            for (var i = 1; i < _this.snapGrid.length; i++) {
1804                if (-currentPosition === _this.snapGrid[i]) {
1805                    newPosition = -_this.snapGrid[i - 1];
1806                    break;
1807                }
1808                if (-currentPosition > _this.snapGrid[i] && -currentPosition < _this.snapGrid[i + 1]) {
1809                    newPosition = -_this.snapGrid[i];
1810                    break;
1811                }
1812            }
1813        }
1814        else {
1815            var groupSize = slideSize * params.slidesPerGroup;
1816            newPosition = -(Math.ceil(-currentPosition / groupSize) - 1) * groupSize;
1817        }
1818
1819        if (newPosition > 0) newPosition = 0;
1820
1821        if (newPosition === currentPosition) return false;
1822        swipeToPosition(newPosition, 'prev');
1823        return true;
1824
1825    };
1826    _this.swipeReset = function () {
1827        _this.callPlugins('onSwipeReset');
1828        var currentPosition = _this.getWrapperTranslate();
1829        var groupSize = slideSize * params.slidesPerGroup;
1830        var newPosition;
1831        var maxPosition = -maxWrapperPosition();
1832        if (params.slidesPerView === 'auto') {
1833            newPosition = 0;
1834            for (var i = 0; i < _this.snapGrid.length; i++) {
1835                if (-currentPosition === _this.snapGrid[i]) return;
1836                if (-currentPosition >= _this.snapGrid[i] && -currentPosition < _this.snapGrid[i + 1]) {
1837                    if (_this.positions.diff > 0) newPosition = -_this.snapGrid[i + 1];
1838                    else newPosition = -_this.snapGrid[i];
1839                    break;
1840                }
1841            }
1842            if (-currentPosition >= _this.snapGrid[_this.snapGrid.length - 1]) newPosition = -_this.snapGrid[_this.snapGrid.length - 1];
1843            if (currentPosition <= -maxWrapperPosition()) newPosition = -maxWrapperPosition();
1844        }
1845        else {
1846            newPosition = currentPosition < 0 ? Math.round(currentPosition / groupSize) * groupSize : 0;
1847            if (currentPosition <= -maxWrapperPosition()) newPosition = -maxWrapperPosition();
1848        }
1849        if (params.scrollContainer)  {
1850            newPosition = currentPosition < 0 ? currentPosition : 0;
1851        }
1852        if (newPosition < -maxWrapperPosition()) {
1853            newPosition = -maxWrapperPosition();
1854        }
1855        if (params.scrollContainer && (containerSize > slideSize)) {
1856            newPosition = 0;
1857        }
1858
1859        if (newPosition === currentPosition) return false;
1860
1861        swipeToPosition(newPosition, 'reset');
1862        return true;
1863    };
1864
1865    _this.swipeTo = function (index, speed, runCallbacks) {
1866        index = parseInt(index, 10);
1867        _this.callPlugins('onSwipeTo', {index: index, speed: speed});
1868        if (params.loop) index = index + _this.loopedSlides;
1869        var currentPosition = _this.getWrapperTranslate();
1870        if (index > (_this.slides.length - 1) || index < 0) return;
1871        var newPosition;
1872        if (params.slidesPerView === 'auto') {
1873            newPosition = -_this.slidesGrid[index];
1874        }
1875        else {
1876            newPosition = -index * slideSize;
1877        }
1878        if (newPosition < - maxWrapperPosition()) {
1879            newPosition = - maxWrapperPosition();
1880        }
1881
1882        if (newPosition === currentPosition) return false;
1883
1884        runCallbacks = runCallbacks === false ? false : true;
1885        swipeToPosition(newPosition, 'to', {index: index, speed: speed, runCallbacks: runCallbacks});
1886        return true;
1887    };
1888
1889    function swipeToPosition(newPosition, action, toOptions) {
1890        var speed = (action === 'to' && toOptions.speed >= 0) ? toOptions.speed : params.speed;
1891        var timeOld = + new Date();
1892
1893        function anim() {
1894            var timeNew = + new Date();
1895            var time = timeNew - timeOld;
1896            currentPosition += animationStep * time / (1000 / 60);
1897            condition = direction === 'toNext' ? currentPosition > newPosition : currentPosition < newPosition;
1898            if (condition) {
1899                _this.setWrapperTranslate(Math.ceil(currentPosition));
1900                _this._DOMAnimating = true;
1901                window.setTimeout(function () {
1902                    anim();
1903                }, 1000 / 60);
1904            }
1905            else {
1906                if (params.onSlideChangeEnd) {
1907                    if (action === 'to') {
1908                        if (toOptions.runCallbacks === true) _this.fireCallback(params.onSlideChangeEnd, _this, direction);
1909                    }
1910                    else {
1911                        _this.fireCallback(params.onSlideChangeEnd, _this, direction);
1912                    }
1913                    
1914                }
1915                _this.setWrapperTranslate(newPosition);
1916                _this._DOMAnimating = false;
1917            }
1918        }
1919
1920        if (_this.support.transitions || !params.DOMAnimation) {
1921            _this.setWrapperTranslate(newPosition);
1922            _this.setWrapperTransition(speed);
1923        }
1924        else {
1925            //Try the DOM animation
1926            var currentPosition = _this.getWrapperTranslate();
1927            var animationStep = Math.ceil((newPosition - currentPosition) / speed * (1000 / 60));
1928            var direction = currentPosition > newPosition ? 'toNext' : 'toPrev';
1929            var condition = direction === 'toNext' ? currentPosition > newPosition : currentPosition < newPosition;
1930            if (_this._DOMAnimating) return;
1931
1932            anim();
1933        }
1934
1935        //Update Active Slide Index
1936        _this.updateActiveSlide(newPosition);
1937
1938        //Callbacks
1939        if (params.onSlideNext && action === 'next') {
1940            _this.fireCallback(params.onSlideNext, _this, newPosition);
1941        }
1942        if (params.onSlidePrev && action === 'prev') {
1943            _this.fireCallback(params.onSlidePrev, _this, newPosition);
1944        }
1945        //'Reset' Callback
1946        if (params.onSlideReset && action === 'reset') {
1947            _this.fireCallback(params.onSlideReset, _this, newPosition);
1948        }
1949
1950        //'Next', 'Prev' and 'To' Callbacks
1951        if (action === 'next' || action === 'prev' || (action === 'to' && toOptions.runCallbacks === true))
1952            slideChangeCallbacks(action);
1953    }
1954    /*==================================================
1955        Transition Callbacks
1956    ====================================================*/
1957    //Prevent Multiple Callbacks
1958    _this._queueStartCallbacks = false;
1959    _this._queueEndCallbacks = false;
1960    function slideChangeCallbacks(direction) {
1961        //Transition Start Callback
1962        _this.callPlugins('onSlideChangeStart');
1963        if (params.onSlideChangeStart) {
1964            if (params.queueStartCallbacks && _this.support.transitions) {
1965                if (_this._queueStartCallbacks) return;
1966                _this._queueStartCallbacks = true;
1967                _this.fireCallback(params.onSlideChangeStart, _this, direction);
1968                _this.wrapperTransitionEnd(function () {
1969                    _this._queueStartCallbacks = false;
1970                });
1971            }
1972            else _this.fireCallback(params.onSlideChangeStart, _this, direction);
1973        }
1974        //Transition End Callback
1975        if (params.onSlideChangeEnd) {
1976            if (_this.support.transitions) {
1977                if (params.queueEndCallbacks) {
1978                    if (_this._queueEndCallbacks) return;
1979                    _this._queueEndCallbacks = true;
1980                    _this.wrapperTransitionEnd(function (swiper) {
1981                        _this.fireCallback(params.onSlideChangeEnd, swiper, direction);
1982                    });
1983                }
1984                else {
1985                    _this.wrapperTransitionEnd(function (swiper) {
1986                        _this.fireCallback(params.onSlideChangeEnd, swiper, direction);
1987                    });
1988                }
1989            }
1990            else {
1991                if (!params.DOMAnimation) {
1992                    setTimeout(function () {
1993                        _this.fireCallback(params.onSlideChangeEnd, _this, direction);
1994                    }, 10);
1995                }
1996            }
1997        }
1998    }
1999
2000    /*==================================================
2001        Update Active Slide Index
2002    ====================================================*/
2003    _this.updateActiveSlide = function (position) {
2004        if (!_this.initialized) return;
2005        if (_this.slides.length === 0) return;
2006        _this.previousIndex = _this.activeIndex;
2007        if (typeof position === 'undefined') position = _this.getWrapperTranslate();
2008        if (position > 0) position = 0;
2009        var i;
2010        if (params.slidesPerView === 'auto') {
2011            var slidesOffset = 0;
2012            _this.activeIndex = _this.slidesGrid.indexOf(-position);
2013            if (_this.activeIndex < 0) {
2014                for (i = 0; i < _this.slidesGrid.length - 1; i++) {
2015                    if (-position > _this.slidesGrid[i] && -position < _this.slidesGrid[i + 1]) {
2016                        break;
2017                    }
2018                }
2019                var leftDistance = Math.abs(_this.slidesGrid[i] + position);
2020                var rightDistance = Math.abs(_this.slidesGrid[i + 1] + position);
2021                if (leftDistance <= rightDistance) _this.activeIndex = i;
2022                else _this.activeIndex = i + 1;
2023            }
2024        }
2025        else {
2026            _this.activeIndex = Math[params.visibilityFullFit ? 'ceil' : 'round'](-position / slideSize);
2027        }
2028
2029        if (_this.activeIndex === _this.slides.length) _this.activeIndex = _this.slides.length - 1;
2030        if (_this.activeIndex < 0) _this.activeIndex = 0;
2031
2032        // Check for slide
2033        if (!_this.slides[_this.activeIndex]) return;
2034
2035        // Calc Visible slides
2036        _this.calcVisibleSlides(position);
2037
2038        // Mark visible and active slides with additonal classes
2039        if (_this.support.classList) {
2040            var slide;
2041            for (i = 0; i < _this.slides.length; i++) {
2042                slide = _this.slides[i];
2043                slide.classList.remove(params.slideActiveClass);
2044                if (_this.visibleSlides.indexOf(slide) >= 0) {
2045                    slide.classList.add(params.slideVisibleClass);
2046                } else {
2047                    slide.classList.remove(params.slideVisibleClass);
2048                }
2049            }
2050            _this.slides[_this.activeIndex].classList.add(params.slideActiveClass);
2051        } else {
2052            var activeClassRegexp = new RegExp('\\s*' + params.slideActiveClass);
2053            var inViewClassRegexp = new RegExp('\\s*' + params.slideVisibleClass);
2054
2055            for (i = 0; i < _this.slides.length; i++) {
2056                _this.slides[i].className = _this.slides[i].className.replace(activeClassRegexp, '').replace(inViewClassRegexp, '');
2057                if (_this.visibleSlides.indexOf(_this.slides[i]) >= 0) {
2058                    _this.slides[i].className += ' ' + params.slideVisibleClass;
2059                }
2060            }
2061            _this.slides[_this.activeIndex].className += ' ' + params.slideActiveClass;
2062        }
2063
2064        //Update loop index
2065        if (params.loop) {
2066            var ls = _this.loopedSlides;
2067            _this.activeLoopIndex = _this.activeIndex - ls;
2068            if (_this.activeLoopIndex >= _this.slides.length - ls * 2) {
2069                _this.activeLoopIndex = _this.slides.length - ls * 2 - _this.activeLoopIndex;
2070            }
2071            if (_this.activeLoopIndex < 0) {
2072                _this.activeLoopIndex = _this.slides.length - ls * 2 + _this.activeLoopIndex;
2073            }
2074            if (_this.activeLoopIndex < 0) _this.activeLoopIndex = 0;
2075        }
2076        else {
2077            _this.activeLoopIndex = _this.activeIndex;
2078        }
2079        //Update Pagination
2080        if (params.pagination) {
2081            _this.updatePagination(position);
2082        }
2083    };
2084    /*==================================================
2085        Pagination
2086    ====================================================*/
2087    _this.createPagination = function (firstInit) {
2088        if (params.paginationClickable && _this.paginationButtons) {
2089            removePaginationEvents();
2090        }
2091        _this.paginationContainer = params.pagination.nodeType ? params.pagination : $$(params.pagination)[0];
2092        if (params.createPagination) {
2093            var paginationHTML = '';
2094            var numOfSlides = _this.slides.length;
2095            var numOfButtons = numOfSlides;
2096            if (params.loop) numOfButtons -= _this.loopedSlides * 2;
2097            for (var i = 0; i < numOfButtons; i++) {
2098                paginationHTML += '<' + params.paginationElement + ' class="' + params.paginationElementClass + '"></' + params.paginationElement + '>';
2099            }
2100            _this.paginationContainer.innerHTML = paginationHTML;
2101        }
2102        _this.paginationButtons = $$('.' + params.paginationElementClass, _this.paginationContainer);
2103        if (!firstInit) _this.updatePagination();
2104        _this.callPlugins('onCreatePagination');
2105        if (params.paginationClickable) {
2106            addPaginationEvents();
2107        }
2108    };
2109    function removePaginationEvents() {
2110        var pagers = _this.paginationButtons;
2111        if (pagers) {
2112            for (var i = 0; i < pagers.length; i++) {
2113                _this.h.removeEventListener(pagers[i], 'click', paginationClick);
2114            }
2115        }
2116    }
2117    function addPaginationEvents() {
2118        var pagers = _this.paginationButtons;
2119        if (pagers) {
2120            for (var i = 0; i < pagers.length; i++) {
2121                _this.h.addEventListener(pagers[i], 'click', paginationClick);
2122            }
2123        }
2124    }
2125    function paginationClick(e) {
2126        var index;
2127        var target = e.target || e.srcElement;
2128        var pagers = _this.paginationButtons;
2129        for (var i = 0; i < pagers.length; i++) {
2130            if (target === pagers[i]) index = i;
2131        }
2132        if (params.autoplay) _this.stopAutoplay(true);
2133        _this.swipeTo(index);
2134    }
2135    _this.updatePagination = function (position) {
2136        if (!params.pagination) return;
2137        if (_this.slides.length < 1) return;
2138        var activePagers = $$('.' + params.paginationActiveClass, _this.paginationContainer);
2139        if (!activePagers) return;
2140
2141        //Reset all Buttons' class to not active
2142        var pagers = _this.paginationButtons;
2143        if (pagers.length === 0) return;
2144        for (var i = 0; i < pagers.length; i++) {
2145            pagers[i].className = params.paginationElementClass;
2146        }
2147
2148        var indexOffset = params.loop ? _this.loopedSlides : 0;
2149        if (params.paginationAsRange) {
2150            if (!_this.visibleSlides) _this.calcVisibleSlides(position);
2151            //Get Visible Indexes
2152            var visibleIndexes = [];
2153            var j; // lopp index - avoid JSHint W004 / W038
2154            for (j = 0; j < _this.visibleSlides.length; j++) {
2155                var visIndex = _this.slides.indexOf(_this.visibleSlides[j]) - indexOffset;
2156
2157                if (params.loop && visIndex < 0) {
2158                    visIndex = _this.slides.length - _this.loopedSlides * 2 + visIndex;
2159                }
2160                if (params.loop && visIndex >= _this.slides.length - _this.loopedSlides * 2) {
2161                    visIndex = _this.slides.length - _this.loopedSlides * 2 - visIndex;
2162                    visIndex = Math.abs(visIndex);
2163                }
2164                visibleIndexes.push(visIndex);
2165            }
2166
2167            for (j = 0; j < visibleIndexes.length; j++) {
2168                if (pagers[visibleIndexes[j]]) pagers[visibleIndexes[j]].className += ' ' + params.paginationVisibleClass;
2169            }
2170
2171            if (params.loop) {
2172                if (pagers[_this.activeLoopIndex] !== undefined) {
2173                    pagers[_this.activeLoopIndex].className += ' ' + params.paginationActiveClass;
2174                }
2175            }
2176            else {
2177                pagers[_this.activeIndex].className += ' ' + params.paginationActiveClass;
2178            }
2179        }
2180        else {
2181            if (params.loop) {
2182                if (pagers[_this.activeLoopIndex]) pagers[_this.activeLoopIndex].className += ' ' + params.paginationActiveClass + ' ' + params.paginationVisibleClass;
2183            }
2184            else {
2185                pagers[_this.activeIndex].className += ' ' + params.paginationActiveClass + ' ' + params.paginationVisibleClass;
2186            }
2187        }
2188    };
2189    _this.calcVisibleSlides = function (position) {
2190        var visibleSlides = [];
2191        var _slideLeft = 0, _slideSize = 0, _slideRight = 0;
2192        if (isH && _this.wrapperLeft > 0) position = position + _this.wrapperLeft;
2193        if (!isH && _this.wrapperTop > 0) position = position + _this.wrapperTop;
2194
2195        for (var i = 0; i < _this.slides.length; i++) {
2196            _slideLeft += _slideSize;
2197            if (params.slidesPerView === 'auto')
2198                _slideSize  = isH ? _this.h.getWidth(_this.slides[i], true, params.roundLengths) : _this.h.getHeight(_this.slides[i], true, params.roundLengths);
2199            else _slideSize = slideSize;
2200
2201            _slideRight = _slideLeft + _slideSize;
2202            var isVisibile = false;
2203            if (params.visibilityFullFit) {
2204                if (_slideLeft >= -position && _slideRight <= -position + containerSize) isVisibile = true;
2205                if (_slideLeft <= -position && _slideRight >= -position + containerSize) isVisibile = true;
2206            }
2207            else {
2208                if (_slideRight > -position && _slideRight <= ((-position + containerSize))) isVisibile = true;
2209                if (_slideLeft >= -position && _slideLeft < ((-position + containerSize))) isVisibile = true;
2210                if (_slideLeft < -position && _slideRight > ((-position + containerSize))) isVisibile = true;
2211            }
2212
2213            if (isVisibile) visibleSlides.push(_this.slides[i]);
2214
2215        }
2216        if (visibleSlides.length === 0) visibleSlides = [_this.slides[_this.activeIndex]];
2217
2218        _this.visibleSlides = visibleSlides;
2219    };
2220
2221    /*==========================================
2222        Autoplay
2223    ============================================*/
2224    var autoplayTimeoutId, autoplayIntervalId;
2225    _this.startAutoplay = function () {
2226        if (_this.support.transitions) {
2227            if (typeof autoplayTimeoutId !== 'undefined') return false;
2228            if (!params.autoplay) return;
2229            _this.callPlugins('onAutoplayStart');
2230            if (params.onAutoplayStart) _this.fireCallback(params.onAutoplayStart, _this);
2231            autoplay();
2232        }
2233        else {
2234            if (typeof autoplayIntervalId !== 'undefined') return false;
2235            if (!params.autoplay) return;
2236            _this.callPlugins('onAutoplayStart');
2237            if (params.onAutoplayStart) _this.fireCallback(params.onAutoplayStart, _this);
2238            autoplayIntervalId = setInterval(function () {
2239                if (params.loop) {
2240                    _this.fixLoop();
2241                    _this.swipeNext(true);
2242                }
2243                else if (!_this.swipeNext(true)) {
2244                    if (!params.autoplayStopOnLast) _this.swipeTo(0);
2245                    else {
2246                        clearInterval(autoplayIntervalId);
2247                        autoplayIntervalId = undefined;
2248                    }
2249                }
2250            }, params.autoplay);
2251        }
2252    };
2253    _this.stopAutoplay = function (internal) {
2254        if (_this.support.transitions) {
2255            if (!autoplayTimeoutId) return;
2256            if (autoplayTimeoutId) clearTimeout(autoplayTimeoutId);
2257            autoplayTimeoutId = undefined;
2258            if (internal && !params.autoplayDisableOnInteraction) {
2259                _this.wrapperTransitionEnd(function () {
2260                    autoplay();
2261                });
2262            }
2263            _this.callPlugins('onAutoplayStop');
2264            if (params.onAutoplayStop) _this.fireCallback(params.onAutoplayStop, _this);
2265        }
2266        else {
2267            if (autoplayIntervalId) clearInterval(autoplayIntervalId);
2268            autoplayIntervalId = undefined;
2269            _this.callPlugins('onAutoplayStop');
2270            if (params.onAutoplayStop) _this.fireCallback(params.onAutoplayStop, _this);
2271        }
2272    };
2273    function autoplay() {
2274        autoplayTimeoutId = setTimeout(function () {
2275            if (params.loop) {
2276                _this.fixLoop();
2277                _this.swipeNext(true);
2278            }
2279            else if (!_this.swipeNext(true)) {
2280                if (!params.autoplayStopOnLast) _this.swipeTo(0);
2281                else {
2282                    clearTimeout(autoplayTimeoutId);
2283                    autoplayTimeoutId = undefined;
2284                }
2285            }
2286            _this.wrapperTransitionEnd(function () {
2287                if (typeof autoplayTimeoutId !== 'undefined') autoplay();
2288            });
2289        }, params.autoplay);
2290    }
2291    /*==================================================
2292        Loop
2293    ====================================================*/
2294    _this.loopCreated = false;
2295    _this.removeLoopedSlides = function () {
2296        if (_this.loopCreated) {
2297            for (var i = 0; i < _this.slides.length; i++) {
2298                if (_this.slides[i].getData('looped') === true) _this.wrapper.removeChild(_this.slides[i]);
2299            }
2300        }
2301    };
2302
2303    _this.createLoop = function () {
2304        if (_this.slides.length === 0) return;
2305        if (params.slidesPerView === 'auto') {
2306            _this.loopedSlides = params.loopedSlides || 1;
2307        }
2308        else {
2309            _this.loopedSlides = params.slidesPerView + params.loopAdditionalSlides;
2310        }
2311
2312        if (_this.loopedSlides > _this.slides.length) {
2313            _this.loopedSlides = _this.slides.length;
2314        }
2315
2316        var slideFirstHTML = '',
2317            slideLastHTML = '',
2318            i;
2319        var slidesSetFullHTML = '';
2320        /**
2321                loopedSlides is too large if loopAdditionalSlides are set.
2322                Need to divide the slides by maximum number of slides existing.
2323
2324                @author        Tomaz Lovrec <[email protected]>
2325        */
2326        var numSlides = _this.slides.length;
2327        var fullSlideSets = Math.floor(_this.loopedSlides / numSlides);
2328        var remainderSlides = _this.loopedSlides % numSlides;
2329        // assemble full sets of slides
2330        for (i = 0; i < (fullSlideSets * numSlides); i++) {
2331            var j = i;
2332            if (i >= numSlides) {
2333                var over = Math.floor(i / numSlides);
2334                j = i - (numSlides * over);
2335            }
2336            slidesSetFullHTML += _this.slides[j].outerHTML;
2337        }
2338        // assemble remainder slides
2339        // assemble remainder appended to existing slides
2340        for (i = 0; i < remainderSlides;i++) {
2341            slideLastHTML += addClassToHtmlString(params.slideDuplicateClass, _this.slides[i].outerHTML);
2342        }
2343        // assemble slides that get preppended to existing slides
2344        for (i = numSlides - remainderSlides; i < numSlides;i++) {
2345            slideFirstHTML += addClassToHtmlString(params.slideDuplicateClass, _this.slides[i].outerHTML);
2346        }
2347        // assemble all slides
2348        var slides = slideFirstHTML + slidesSetFullHTML + wrapper.innerHTML + slidesSetFullHTML + slideLastHTML;
2349        // set the slides
2350        wrapper.innerHTML = slides;
2351
2352        _this.loopCreated = true;
2353        _this.calcSlides();
2354
2355        //Update Looped Slides with special class
2356        for (i = 0; i < _this.slides.length; i++) {
2357            if (i < _this.loopedSlides || i >= _this.slides.length - _this.loopedSlides) _this.slides[i].setData('looped', true);
2358        }
2359        _this.callPlugins('onCreateLoop');
2360
2361    };
2362
2363    _this.fixLoop = function () {
2364        var newIndex;
2365        //Fix For Negative Oversliding
2366        if (_this.activeIndex < _this.loopedSlides) {
2367            newIndex = _this.slides.length - _this.loopedSlides * 3 + _this.activeIndex;
2368            _this.swipeTo(newIndex, 0, false);
2369        }
2370        //Fix For Positive Oversliding
2371        else if ((params.slidesPerView === 'auto' && _this.activeIndex >= _this.loopedSlides * 2) || (_this.activeIndex > _this.slides.length - params.slidesPerView * 2)) {
2372            newIndex = -_this.slides.length + _this.activeIndex + _this.loopedSlides;
2373            _this.swipeTo(newIndex, 0, false);
2374        }
2375    };
2376
2377    /*==================================================
2378        Slides Loader
2379    ====================================================*/
2380    _this.loadSlides = function () {
2381        var slidesHTML = '';
2382        _this.activeLoaderIndex = 0;
2383        var slides = params.loader.slides;
2384        var slidesToLoad = params.loader.loadAllSlides ? slides.length : params.slidesPerView * (1 + params.loader.surroundGroups);
2385        for (var i = 0; i < slidesToLoad; i++) {
2386            if (params.loader.slidesHTMLType === 'outer') slidesHTML += slides[i];
2387            else {
2388                slidesHTML += '<' + params.slideElement + ' class="' + params.slideClass + '" data-swiperindex="' + i + '">' + slides[i] + '</' + params.slideElement + '>';
2389            }
2390        }
2391        _this.wrapper.innerHTML = slidesHTML;
2392        _this.calcSlides(true);
2393        //Add permanent transitionEnd callback
2394        if (!params.loader.loadAllSlides) {
2395            _this.wrapperTransitionEnd(_this.reloadSlides, true);
2396        }
2397    };
2398
2399    _this.reloadSlides = function () {
2400        var slides = params.loader.slides;
2401        var newActiveIndex = parseInt(_this.activeSlide().data('swiperindex'), 10);
2402        if (newActiveIndex < 0 || newActiveIndex > slides.length - 1) return; //<-- Exit
2403        _this.activeLoaderIndex = newActiveIndex;
2404        var firstIndex = Math.max(0, newActiveIndex - params.slidesPerView * params.loader.surroundGroups);
2405        var lastIndex = Math.min(newActiveIndex + params.slidesPerView * (1 + params.loader.surroundGroups) - 1, slides.length - 1);
2406        //Update Transforms
2407        if (newActiveIndex > 0) {
2408            var newTransform = -slideSize * (newActiveIndex - firstIndex);
2409            _this.setWrapperTranslate(newTransform);
2410            _this.setWrapperTransition(0);
2411        }
2412        var i; // loop index
2413        //New Slides
2414        if (params.loader.logic === 'reload') {
2415            _this.wrapper.innerHTML = '';
2416            var slidesHTML = '';
2417            for (i = firstIndex; i <= lastIndex; i++) {
2418                slidesHTML += params.loader.slidesHTMLType === 'outer' ? slides[i] : '<' + params.slideElement + ' class="' + params.slideClass + '" data-swiperindex="' + i + '">' + slides[i] + '</' + params.slideElement + '>';
2419            }
2420            _this.wrapper.innerHTML = slidesHTML;
2421        }
2422        else {
2423            var minExistIndex = 1000;
2424            var maxExistIndex = 0;
2425
2426            for (i = 0; i < _this.slides.length; i++) {
2427                var index = _this.slides[i].data('swiperindex');
2428                if (index < firstIndex || index > lastIndex) {
2429                    _this.wrapper.removeChild(_this.slides[i]);
2430                }
2431                else {
2432                    minExistIndex = Math.min(index, minExistIndex);
2433                    maxExistIndex = Math.max(index, maxExistIndex);
2434                }
2435            }
2436            for (i = firstIndex; i <= lastIndex; i++) {
2437                var newSlide;
2438                if (i < minExistIndex) {
2439                    newSlide = document.createElement(params.slideElement);
2440                    newSlide.className = params.slideClass;
2441                    newSlide.setAttribute('data-swiperindex', i);
2442                    newSlide.innerHTML = slides[i];
2443                    _this.wrapper.insertBefore(newSlide, _this.wrapper.firstChild);
2444                }
2445                if (i > maxExistIndex) {
2446                    newSlide = document.createElement(params.slideElement);
2447                    newSlide.className = params.slideClass;
2448                    newSlide.setAttribute('data-swiperindex', i);
2449                    newSlide.innerHTML = slides[i];
2450                    _this.wrapper.appendChild(newSlide);
2451                }
2452            }
2453        }
2454        //reInit
2455        _this.reInit(true);
2456    };
2457
2458    /*==================================================
2459        Make Swiper
2460    ====================================================*/
2461    function makeSwiper() {
2462        _this.calcSlides();
2463        if (params.loader.slides.length > 0 && _this.slides.length === 0) {
2464            _this.loadSlides();
2465        }
2466        if (params.loop) {
2467            _this.createLoop();
2468        }
2469        _this.init();
2470        initEvents();
2471        if (params.pagination) {
2472            _this.createPagination(true);
2473        }
2474
2475        if (params.loop || params.initialSlide > 0) {
2476            _this.swipeTo(params.initialSlide, 0, false);
2477        }
2478        else {
2479            _this.updateActiveSlide(0);
2480        }
2481        if (params.autoplay) {
2482            _this.startAutoplay();
2483        }
2484        /**
2485         * Set center slide index.
2486         *
2487         * @author        Tomaz Lovrec <[email protected]>
2488         */
2489        _this.centerIndex = _this.activeIndex;
2490
2491        // Callbacks
2492        if (params.onSwiperCreated) _this.fireCallback(params.onSwiperCreated, _this);
2493        _this.callPlugins('onSwiperCreated');
2494    }
2495
2496    makeSwiper();
2497};
2498
2499Swiper.prototype = {
2500    plugins : {},
2501
2502    /*==================================================
2503        Wrapper Operations
2504    ====================================================*/
2505    wrapperTransitionEnd : function (callback, permanent) {
2506        'use strict';
2507        var a = this,
2508            el = a.wrapper,
2509            events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],
2510            i;
2511
2512        function fireCallBack(e) {
2513            if (e.target !== el) return;
2514            callback(a);
2515            if (a.params.queueEndCallbacks) a._queueEndCallbacks = false;
2516            if (!permanent) {
2517                for (i = 0; i < events.length; i++) {
2518                    a.h.removeEventListener(el, events[i], fireCallBack);
2519                }
2520            }
2521        }
2522
2523        if (callback) {
2524            for (i = 0; i < events.length; i++) {
2525                a.h.addEventListener(el, events[i], fireCallBack);
2526            }
2527        }
2528    },
2529
2530    getWrapperTranslate : function (axis) {
2531        'use strict';
2532        var el = this.wrapper,
2533            matrix, curTransform, curStyle, transformMatrix;
2534
2535        // automatic axis detection
2536        if (typeof axis === 'undefined') {
2537            axis = this.params.mode === 'horizontal' ? 'x' : 'y';
2538        }
2539
2540        if (this.support.transforms && this.params.useCSS3Transforms) {
2541            curStyle = window.getComputedStyle(el, null);
2542            if (window.WebKitCSSMatrix) {
2543                // Some old versions of Webkit choke when 'none' is passed; pass
2544                // empty string instead in this case
2545                transformMatrix = new WebKitCSSMatrix(curStyle.webkitTransform === 'none' ? '' : curStyle.webkitTransform);
2546            }
2547            else {
2548                transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform  || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
2549                matrix = transformMatrix.toString().split(',');
2550            }
2551
2552            if (axis === 'x') {
2553                //Latest Chrome and webkits Fix
2554                if (window.WebKitCSSMatrix)
2555                    curTransform = transformMatrix.m41;
2556                //Crazy IE10 Matrix
2557                else if (matrix.length === 16)
2558                    curTransform = parseFloat(matrix[12]);
2559                //Normal Browsers
2560                else
2561                    curTransform = parseFloat(matrix[4]);
2562            }
2563            if (axis === 'y') {
2564                //Latest Chrome and webkits Fix
2565                if (window.WebKitCSSMatrix)
2566                    curTransform = transformMatrix.m42;
2567                //Crazy IE10 Matrix
2568                else if (matrix.length === 16)
2569                    curTransform = parseFloat(matrix[13]);
2570                //Normal Browsers
2571                else
2572                    curTransform = parseFloat(matrix[5]);
2573            }
2574        }
2575        else {
2576            if (axis === 'x') curTransform = parseFloat(el.style.left, 10) || 0;
2577            if (axis === 'y') curTransform = parseFloat(el.style.top, 10) || 0;
2578        }
2579        return curTransform || 0;
2580    },
2581
2582    setWrapperTranslate : function (x, y, z) {
2583        'use strict';
2584        var es = this.wrapper.style,
2585            coords = {x: 0, y: 0, z: 0},
2586            translate;
2587
2588        // passed all coordinates
2589        if (arguments.length === 3) {
2590            coords.x = x;
2591            coords.y = y;
2592            coords.z = z;
2593        }
2594
2595        // passed one coordinate and optional axis
2596        else {
2597            if (typeof y === 'undefined') {
2598                y = this.params.mode === 'horizontal' ? 'x' : 'y';
2599            }
2600            coords[y] = x;
2601        }
2602
2603        if (this.support.transforms && this.params.useCSS3Transforms) {
2604            translate = this.support.transforms3d ? 'translate3d(' + coords.x + 'px, ' + coords.y + 'px, ' + coords.z + 'px)' : 'translate(' + coords.x + 'px, ' + coords.y + 'px)';
2605            es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = translate;
2606        }
2607        else {
2608            es.left = coords.x + 'px';
2609            es.top  = coords.y + 'px';
2610        }
2611        this.callPlugins('onSetWrapperTransform', coords);
2612        if (this.params.onSetWrapperTransform) this.fireCallback(this.params.onSetWrapperTransform, this, coords);
2613    },
2614
2615    setWrapperTransition : function (duration) {
2616        'use strict';
2617        var es = this.wrapper.style;
2618        es.webkitTransitionDuration = es.MsTransitionDuration = es.msTransitionDuration = es.MozTransitionDuration = es.OTransitionDuration = es.transitionDuration = (duration / 1000) + 's';
2619        this.callPlugins('onSetWrapperTransition', {duration: duration});
2620        if (this.params.onSetWrapperTransition) this.fireCallback(this.params.onSetWrapperTransition, this, duration);
2621
2622    },
2623
2624    /*==================================================
2625        Helpers
2626    ====================================================*/
2627    h : {
2628        getWidth: function (el, outer, round) {
2629            'use strict';
2630            var width = window.getComputedStyle(el, null).getPropertyValue('width');
2631            var returnWidth = parseFloat(width);
2632            //IE Fixes
2633            if (isNaN(returnWidth) || width.indexOf('%') > 0 || returnWidth < 0) {
2634                returnWidth = el.offsetWidth - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-left')) - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-right'));
2635            }
2636            if (outer) returnWidth += parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-left')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-right'));
2637            if (round) return Math.ceil(returnWidth);
2638            else return returnWidth;
2639        },
2640        getHeight: function (el, outer, round) {
2641            'use strict';
2642            if (outer) return el.offsetHeight;
2643
2644            var height = window.getComputedStyle(el, null).getPropertyValue('height');
2645            var returnHeight = parseFloat(height);
2646            //IE Fixes
2647            if (isNaN(returnHeight) || height.indexOf('%') > 0 || returnHeight < 0) {
2648                returnHeight = el.offsetHeight - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-top')) - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-bottom'));
2649            }
2650            if (outer) returnHeight += parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-bottom'));
2651            if (round) return Math.ceil(returnHeight);
2652            else return returnHeight;
2653        },
2654        getOffset: function (el) {
2655            'use strict';
2656            var box = el.getBoundingClientRect();
2657            var body = document.body;
2658            var clientTop  = el.clientTop  || body.clientTop  || 0;
2659            var clientLeft = el.clientLeft || body.clientLeft || 0;
2660            var scrollTop  = window.pageYOffset || el.scrollTop;
2661            var scrollLeft = window.pageXOffset || el.scrollLeft;
2662            if (document.documentElement && !window.pageYOffset) {
2663                //IE7-8
2664                scrollTop  = document.documentElement.scrollTop;
2665                scrollLeft = document.documentElement.scrollLeft;
2666            }
2667            return {
2668                top: box.top  + scrollTop  - clientTop,
2669                left: box.left + scrollLeft - clientLeft
2670            };
2671        },
2672        windowWidth : function () {
2673            'use strict';
2674            if (window.innerWidth) return window.innerWidth;
2675            else if (document.documentElement && document.documentElement.clientWidth) return document.documentElement.clientWidth;
2676        },
2677        windowHeight : function () {
2678            'use strict';
2679            if (window.innerHeight) return window.innerHeight;
2680            else if (document.documentElement && document.documentElement.clientHeight) return document.documentElement.clientHeight;
2681        },
2682        windowScroll : function () {
2683            'use strict';
2684            if (typeof pageYOffset !== 'undefined') {
2685                return {
2686                    left: window.pageXOffset,
2687                    top: window.pageYOffset
2688                };
2689            }
2690            else if (document.documentElement) {
2691                return {
2692                    left: document.documentElement.scrollLeft,
2693                    top: document.documentElement.scrollTop
2694                };
2695            }
2696        },
2697
2698        addEventListener : function (el, event, listener, useCapture) {
2699            'use strict';
2700            if (typeof useCapture === 'undefined') {
2701                useCapture = false;
2702            }
2703
2704            if (el.addEventListener) {
2705                el.addEventListener(event, listener, useCapture);
2706            }
2707            else if (el.attachEvent) {
2708                el.attachEvent('on' + event, listener);
2709            }
2710        },
2711
2712        removeEventListener : function (el, event, listener, useCapture) {
2713            'use strict';
2714            if (typeof useCapture === 'undefined') {
2715                useCapture = false;
2716            }
2717
2718            if (el.removeEventListener) {
2719                el.removeEventListener(event, listener, useCapture);
2720            }
2721            else if (el.detachEvent) {
2722                el.detachEvent('on' + event, listener);
2723            }
2724        }
2725    },
2726    setTransform : function (el, transform) {
2727        'use strict';
2728        var es = el.style;
2729        es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = transform;
2730    },
2731    setTranslate : function (el, translate) {
2732        'use strict';
2733        var es = el.style;
2734        var pos = {
2735            x : translate.x || 0,
2736            y : translate.y || 0,
2737            z : translate.z || 0
2738        };
2739        var transformString = this.support.transforms3d ? 'translate3d(' + (pos.x) + 'px,' + (pos.y) + 'px,' + (pos.z) + 'px)' : 'translate(' + (pos.x) + 'px,' + (pos.y) + 'px)';
2740        es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = transformString;
2741        if (!this.support.transforms) {
2742            es.left = pos.x + 'px';
2743            es.top = pos.y + 'px';
2744        }
2745    },
2746    setTransition : function (el, duration) {
2747        'use strict';
2748        var es = el.style;
2749        es.webkitTransitionDuration = es.MsTransitionDuration = es.msTransitionDuration = es.MozTransitionDuration = es.OTransitionDuration = es.transitionDuration = duration + 'ms';
2750    },
2751    /*==================================================
2752        Feature Detection
2753    ====================================================*/
2754    support: {
2755
2756        touch : (window.Modernizr && Modernizr.touch === true) || (function () {
2757            'use strict';
2758            return !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch);
2759        })(),
2760
2761        transforms3d : (window.Modernizr && Modernizr.csstransforms3d === true) || (function () {
2762            'use strict';
2763            var div = document.createElement('div').style;
2764            return ('webkitPerspective' in div || 'MozPerspective' in div || 'OPerspective' in div || 'MsPerspective' in div || 'perspective' in div);
2765        })(),
2766
2767        transforms : (window.Modernizr && Modernizr.csstransforms === true) || (function () {
2768            'use strict';
2769            var div = document.createElement('div').style;
2770            return ('transform' in div || 'WebkitTransform' in div || 'MozTransform' in div || 'msTransform' in div || 'MsTransform' in div || 'OTransform' in div);
2771        })(),
2772
2773        transitions : (window.Modernizr && Modernizr.csstransitions === true) || (function () {
2774            'use strict';
2775            var div = document.createElement('div').style;
2776            return ('transition' in div || 'WebkitTransition' in div || 'MozTransition' in div || 'msTransition' in div || 'MsTransition' in div || 'OTransition' in div);
2777        })(),
2778
2779        classList : (function () {
2780            'use strict';
2781            var div = document.createElement('div').style;
2782            return 'classList' in div;
2783        })()
2784    },
2785
2786    browser : {
2787
2788        ie8 : (function () {
2789            'use strict';
2790            var rv = -1; // Return value assumes failure.
2791            if (navigator.appName === 'Microsoft Internet Explorer') {
2792                var ua = navigator.userAgent;
2793                var re = new RegExp(/MSIE ([0-9]{1,}[\.0-9]{0,})/);
2794                if (re.exec(ua) !== null)
2795                    rv = parseFloat(RegExp.$1);
2796            }
2797            return rv !== -1 && rv < 9;
2798        })(),
2799
2800        ie10 : window.navigator.msPointerEnabled,
2801        ie11 : window.navigator.pointerEnabled
2802    }
2803};
2804
2805/*=========================
2806  jQuery & Zepto Plugins
2807  ===========================*/
2808if (window.jQuery || window.Zepto) {
2809    (function ($) {
2810        'use strict';
2811        $.fn.swiper = function (params) {
2812            var s = new Swiper($(this)[0], params);
2813            $(this).data('swiper', s);
2814            return s;
2815        };
2816    })(window.jQuery || window.Zepto);
2817}
2818
2819// component
2820if (typeof(module) !== 'undefined')
2821{
2822    module.exports = Swiper;
2823}
2824
2825// requirejs support
2826if (typeof define === 'function' && define.amd) {
2827    define([], function () {
2828        'use strict';
2829        return Swiper;
2830    });
2831}

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.