PageSourceSearch

https://dontforgetme.co.kr/ind-script/optimizer_user.php?filename=…826c0dceb8b890d416567c4&t=1490678945&user=T

js dontforgetme.co.kr collected 2026-10-08 23:34:39 UTC 202,022 bytes, 4,738 lines download raw bytes

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

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.