PageSourceSearch

https://professor.khu.ac.kr/resources/professor/js/slick.js

js khu.ac.kr collected 2026-09-24 08:43:24 UTC 87,998 bytes, 2,918 lines download raw bytes

vendor: 4,890 bytes, lines 1-145
1/*
2     _ _      _       _
3 ___| (_) ___| | __  (_)___
4/ __| | |/ __| |/ /  | / __|
5\__ \ | | (__|   < _ | \__ \
6|___/_|_|\___|_|\_(_)/ |___/
7                   |__/
8
9 Version: 1.6.0
10  Author: Ken Wheeler
11 Website: https://kenwheeler.github.io
12    Docs: https://kenwheeler.github.io/slick
13    Repo: https://github.com/kenwheeler/slick
14  Issues: https://github.com/kenwheeler/slick/issues
15
16 */
17/* global window, document, define, jQuery, setInterval, clearInterval */
18(function(factory) {
19    'use strict';
20    if (typeof define === 'function' && define.amd) {
21        define(['jquery'], factory);
22    } else if (typeof exports !== 'undefined') {
23        module.exports = factory(require('jquery'));
24    } else {
25        factory(jQuery);
26    }
27
28}(function($) {
29    'use strict';
30    var Slick = window.Slick || {};
31
32    Slick = (function() {
33
34        var instanceUid = 0;
35
36        function Slick(element, settings) {
37
38            var _ = this, dataSettings;
39
40            _.defaults = {
41                accessibility: true,
42                adaptiveHeight: false,
43                appendArrows: $(element),
44                appendDots: $(element),
45                arrows: true,
46                asNavFor: null,
47                prevArrow: '<button type="button" data-role="none" class="slick-prev" aria-label="Previous slide" tabindex="0" role="button">Previous slide</button>',
48                nextArrow: '<button type="button" data-role="none" class="slick-next" aria-label="Next slide" tabindex="0" role="button">Next slide</button>',
49                autoplay: false,
50                autoplaySpeed: 3000,
51                centerMode: false,
52                centerPadding: '50px',
53                cssEase: 'ease',
54                customPaging: function(slider, i) {
55                    return $('<button type="button" data-role="none" role="button" tabindex="0" />').text('Slide ' + (i + 1));
56                },
57                dots: false,
58                dotsClass: 'slick-dots',
59                draggable: true,
60                easing: 'linear',
61                edgeFriction: 0.35,
62                fade: false,
63                focusOnSelect: false,
64                infinite: true,
65                initialSlide: 0,
66                lazyLoad: 'ondemand',
67                mobileFirst: false,
68                pauseOnHover: true,
69                pauseOnFocus: true,
70                pauseOnDotsHover: false,
71                respondTo: 'window',
72                responsive: null,
73                rows: 1,
74                rtl: false,
75                slide: '',
76                slidesPerRow: 1,
77                slidesToShow: 1,
78                slidesToScroll: 1,
79                speed: 500,
80                swipe: true,
81                swipeToSlide: false,
82                touchMove: true,
83                touchThreshold: 5,
84                useCSS: true,
85                useTransform: true,
86                variableWidth: false,
87                vertical: false,
88                verticalSwiping: false,
89                waitForAnimate: true,
90                zIndex: 1000
91            };
92
93            _.initials = {
94                animating: false,
95                dragging: false,
96                autoPlayTimer: null,
97                currentDirection: 0,
98                currentLeft: null,
99                currentSlide: 0,
100                direction: 1,
101                $dots: null,
102                listWidth: null,
103                listHeight: null,
104                loadIndex: 0,
105                $nextArrow: null,
106                $prevArrow: null,
107                slideCount: null,
108                slideWidth: null,
109                $slideTrack: null,
110                $slides: null,
111                sliding: false,
112                slideOffset: 0,
113                swipeLeft: null,
114                $list: null,
115                touchObject: {},
116                transformsEnabled: false,
117                unslicked: false
118            };
119
120            $.extend(_, _.initials);
121
122            _.activeBreakpoint = null;
123            _.animType = null;
124            _.animProp = null;
125            _.breakpoints = [];
126            _.breakpointSettings = [];
127            _.cssTransitions = false;
128            _.focussed = false;
129            _.interrupted = false;
130            _.hidden = 'hidden';
131            _.paused = true;
132            _.positionProp = null;
133            _.respondTo = null;
134            _.rowCount = 1;
135            _.shouldClick = true;
136            _.$slider = $(element);
137            _.$slidesCache = null;
138            _.transformType = null;
139            _.transitionType = null;
140            _.visibilityChange = 'visibilitychange';
141            _.windowWidth = 0;
142            _.windowTimer = null;
143
144            dataSettings = $(element).data('slick') || {};
145
146            _.options = $.extend({}, _.defaults, settings, dataSettings);
147
148            _.currentSlide = _.options.initialSlide;
149
150            _.originalSettings = _.options;
151
152            if (typeof document.mozHidden !== 'undefined') {
153                _.hidden = 'mozHidden';
154                _.visibilityChange = 'mozvisibilitychange';
155            } else if (typeof document.webkitHidden !== 'undefined') {
156                _.hidden = 'webkitHidden';
157                _.visibilityChange = 'webkitvisibilitychange';
158            }
159
160            _.autoPlay = $.proxy(_.autoPlay, _);
161            _.autoPlayClear = $.proxy(_.autoPlayClear, _);
162            _.autoPlayIterator = $.proxy(_.autoPlayIterator, _);
163            _.changeSlide = $.proxy(_.changeSlide, _);
164            _.clickHandler = $.proxy(_.clickHandler, _);
165            _.selectHandler = $.proxy(_.selectHandler, _);
166            _.setPosition = $.proxy(_.setPosition, _);
167            _.swipeHandler = $.proxy(_.swipeHandler, _);
168            _.dragHandler = $.proxy(_.dragHandler, _);
169            _.keyHandler = $.proxy(_.keyHandler, _);
170
171            _.instanceUid = instanceUid++;
172
173            // A simple way to check for HTML strings
174            // Strict HTML recognition (must start with <)
175            // Extracted from jQuery v1.11 source
176            _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/;
177
178
179            _.registerBreakpoints();
180            _.init(true);
181
182        }
183
184        return Slick;
185
186    }());
187
188    Slick.prototype.activateADA = function() {
189        var _ = this;
190
191        _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({
192            'aria-hidden': 'true',
193            'tabindex': '-1'
194        }).find('a, input, button, select').attr({
195            'tabindex': '-1'
196        });
197
198        _.$slideTrack.find('.slick-active').attr({
199            'aria-hidden': 'false'
200        }).find('a, input, button, select').attr({
201            'tabindex': '0'
202        });
203
204    };
205
206    Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) {
207
208        var _ = this;
209
210        if (typeof(index) === 'boolean') {
211            addBefore = index;
212            index = null;
213        } else if (index < 0 || (index >= _.slideCount)) {
214            return false;
215        }
216
217        _.unload();
218
219        if (typeof(index) === 'number') {
220            if (index === 0 && _.$slides.length === 0) {
221                $(markup).appendTo(_.$slideTrack);
222            } else if (addBefore) {
223                $(markup).insertBefore(_.$slides.eq(index));
224            } else {
225                $(markup).insertAfter(_.$slides.eq(index));
226            }
227        } else {
228            if (addBefore === true) {
229                $(markup).prependTo(_.$slideTrack);
230            } else {
231                $(markup).appendTo(_.$slideTrack);
232            }
233        }
234
235        _.$slides = _.$slideTrack.children(this.options.slide);
236
237        _.$slideTrack.children(this.options.slide).detach();
238
239        _.$slideTrack.append(_.$slides);
240
241        _.$slides.each(function(index, element) {
242            $(element).attr('data-slick-index', index);
243        });
244
245        _.$slidesCache = _.$slides;
246
247        _.reinit();
248
249    };
250
251    Slick.prototype.animateHeight = function() {
252        var _ = this;
253        if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
254            var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
255            _.$list.animate({
256                height: targetHeight
257            }, _.options.speed);
258        }
259    };
260
261    Slick.prototype.animateSlide = function(targetLeft, callback) {
262
263        var animProps = {},
264            _ = this;
265
266        _.animateHeight();
267
268        if (_.options.rtl === true && _.options.vertical === false) {
269            targetLeft = -targetLeft;
270        }
271        if (_.transformsEnabled === false) {
272            if (_.options.vertical === false) {
273                _.$slideTrack.animate({
274                    left: targetLeft
275                }, _.options.speed, _.options.easing, callback);
276            } else {
277                _.$slideTrack.animate({
278                    top: targetLeft
279                }, _.options.speed, _.options.easing, callback);
280            }
281
282        } else {
283
284            if (_.cssTransitions === false) {
285                if (_.options.rtl === true) {
286                    _.currentLeft = -(_.currentLeft);
287                }
288                $({
289                    animStart: _.currentLeft
290                }).animate({
291                    animStart: targetLeft
292                }, {
293                    duration: _.options.speed,
294                    easing: _.options.easing,
295                    step: function(now) {
296                        now = Math.ceil(now);
297                        if (_.options.vertical === false) {
298                            animProps[_.animType] = 'translate(' +
299                                now + 'px, 0px)';
300                            _.$slideTrack.css(animProps);
301                        } else {
302                            animProps[_.animType] = 'translate(0px,' +
303                                now + 'px)';
304                            _.$slideTrack.css(animProps);
305                        }
306                    },
307                    complete: function() {
308                        if (callback) {
309                            callback.call();
310                        }
311                    }
312                });
313
314            } else {
315
316                _.applyTransition();
317                targetLeft = Math.ceil(targetLeft);
318
319                if (_.options.vertical === false) {
320                    animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)';
321                } else {
322                    animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)';
323                }
324                _.$slideTrack.css(animProps);
325
326                if (callback) {
327                    setTimeout(function() {
328
329                        _.disableTransition();
330
331                        callback.call();
332                    }, _.options.speed);
333                }
334
335            }
336
337        }
338
339    };
340
341    Slick.prototype.getNavTarget = function() {
342
343        var _ = this,
344            asNavFor = _.options.asNavFor;
345
346        if ( asNavFor && asNavFor !== null ) {
347            asNavFor = $(asNavFor).not(_.$slider);
348        }
349
350        return asNavFor;
351
352    };
353
354    Slick.prototype.asNavFor = function(index) {
355
356        var _ = this,
357            asNavFor = _.getNavTarget();
358
359        if ( asNavFor !== null && typeof asNavFor === 'object' ) {
360            asNavFor.each(function() {
361                var target = $(this).slick('getSlick');
362                if(!target.unslicked) {
363                    target.slideHandler(index, true);
364                }
365            });
366        }
367
368    };
369
370    Slick.prototype.applyTransition = function(slide) {
371
372        var _ = this,
373            transition = {};
374
375        if (_.options.fade === false) {
376            transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase;
377        } else {
378            transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase;
379        }
380
381        if (_.options.fade === false) {
382            _.$slideTrack.css(transition);
383        } else {
384            _.$slides.eq(slide).css(transition);
385        }
386
387    };
388
389    Slick.prototype.autoPlay = function() {
390
391        var _ = this;
392
393        _.autoPlayClear();
394
395        if ( _.slideCount > _.options.slidesToShow ) {
396            _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed );
397        }
398
399    };
400
401    Slick.prototype.autoPlayClear = function() {
402
403        var _ = this;
404
405        if (_.autoPlayTimer) {
406            clearInterval(_.autoPlayTimer);
407        }
408
409    };
410
411    Slick.prototype.autoPlayIterator = function() {
412
413        var _ = this,
414            slideTo = _.currentSlide + _.options.slidesToScroll;
415
416        if ( !_.paused && !_.interrupted && !_.focussed ) {
417
418            if ( _.options.infinite === false ) {
419
420                if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) {
421                    _.direction = 0;
422                }
423
424                else if ( _.direction === 0 ) {
425
426                    slideTo = _.currentSlide - _.options.slidesToScroll;
427
428                    if ( _.currentSlide - 1 === 0 ) {
429                        _.direction = 1;
430                    }
431
432                }
433
434            }
435
436            _.slideHandler( slideTo );
437
438        }
439
440    };
441
442    Slick.prototype.buildArrows = function() {
443
444        var _ = this;
445
446        if (_.options.arrows === true ) {
447
448            _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow');
449            _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow');
450
451            if( _.slideCount > _.options.slidesToShow ) {
452
453                _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
454                _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
455
456                if (_.htmlExpr.test(_.options.prevArrow)) {
457                    _.$prevArrow.prependTo(_.options.appendArrows);
458                }
459
460                if (_.htmlExpr.test(_.options.nextArrow)) {
461                    _.$nextArrow.appendTo(_.options.appendArrows);
462                }
463
464                if (_.options.infinite !== true) {
465                    _.$prevArrow
466                        .addClass('slick-disabled')
467                        .attr('aria-disabled', 'true');
468                }
469
470            } else {
471
472                _.$prevArrow.add( _.$nextArrow )
473
474                    .addClass('slick-hidden')
475                    .attr({
476                        'aria-disabled': 'true',
477                        'tabindex': '-1'
478                    });
479
480            }
481
482        }
483
484    };
485
486    Slick.prototype.buildDots = function() {
487
488        var _ = this,
489            i, dot;
490
491        if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
492
493            _.$slider.addClass('slick-dotted');
494
495            dot = $('<ul />').addClass(_.options.dotsClass);
496
497            for (i = 0; i <= _.getDotCount(); i += 1) {
498                dot.append($('<li />').append(_.options.customPaging.call(this, _, i)));
499            }
500
501            _.$dots = dot.appendTo(_.options.appendDots);
502
503            _.$dots.find('li').first().addClass('slick-active').attr('aria-hidden', 'false');
504
505        }
506
507    };
508
509    Slick.prototype.buildOut = function() {
510
511        var _ = this;
512
513        _.$slides =
514            _.$slider
515                .children( _.options.slide + ':not(.slick-cloned)')
516                .addClass('slick-slide');
517
518        _.slideCount = _.$slides.length;
519
520        _.$slides.each(function(index, element) {
521            $(element)
522                .attr('data-slick-index', index)
523                .data('originalStyling', $(element).attr('style') || '');
524        });
525
526        _.$slider.addClass('slick-slider');
527
528        _.$slideTrack = (_.slideCount === 0) ?
529            $('<div class="slick-track"/>').appendTo(_.$slider) :
530            _.$slides.wrapAll('<div class="slick-track"/>').parent();
531
532        _.$list = _.$slideTrack.wrap(
533            '<div aria-live="polite" class="slick-list"/>').parent();
534        _.$slideTrack.css('opacity', 0);
535
536        if (_.options.centerMode === true || _.options.swipeToSlide === true) {
537            _.options.slidesToScroll = 1;
538        }
539
540        $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading');
541
542        _.setupInfinite();
543
544        _.buildArrows();
545
546        _.buildDots();
547
548        _.updateDots();
549
550
551        _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);
552
553        if (_.options.draggable === true) {
554            _.$list.addClass('draggable');
555        }
556
557    };
558
559    Slick.prototype.buildRows = function() {
560
561        var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection;
562
563        newSlides = document.createDocumentFragment();
564        originalSlides = _.$slider.children();
565
566        if(_.options.rows > 1) {
567
568            slidesPerSection = _.options.slidesPerRow * _.options.rows;
569            numOfSlides = Math.ceil(
570                originalSlides.length / slidesPerSection
571            );
572
573            for(a = 0; a < numOfSlides; a++){
574                var slide = document.createElement('div');
575                for(b = 0; b < _.options.rows; b++) {
576                    var row = document.createElement('div');
577                    for(c = 0; c < _.options.slidesPerRow; c++) {
578                        var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c));
579                        if (originalSlides.get(target)) {
580                            row.appendChild(originalSlides.get(target));
581                        }
582                    }
583                    slide.appendChild(row);
584                }
585                newSlides.appendChild(slide);
586            }
587
588            _.$slider.empty().append(newSlides);
589            _.$slider.children().children().children()
590                .css({
591                    'width':(100 / _.options.slidesPerRow) + '%',
592                    'display': 'inline-block'
593                });
594
595        }
596
597    };
598
599    Slick.prototype.checkResponsive = function(initial, forceUpdate) {
600
601        var _ = this,
602            breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false;
603        var sliderWidth = _.$slider.width();
604        var windowWidth = window.innerWidth || $(window).width();
605
606        if (_.respondTo === 'window') {
607            respondToWidth = windowWidth;
608        } else if (_.respondTo === 'slider') {
609            respondToWidth = sliderWidth;
610        } else if (_.respondTo === 'min') {
611            respondToWidth = Math.min(windowWidth, sliderWidth);
612        }
613
614        if ( _.options.responsive &&
615            _.options.responsive.length &&
616            _.options.responsive !== null) {
617
618            targetBreakpoint = null;
619
620            for (breakpoint in _.breakpoints) {
621                if (_.breakpoints.hasOwnProperty(breakpoint)) {
622                    if (_.originalSettings.mobileFirst === false) {
623                        if (respondToWidth < _.breakpoints[breakpoint]) {
624                            targetBreakpoint = _.breakpoints[breakpoint];
625                        }
626                    } else {
627                        if (respondToWidth > _.breakpoints[breakpoint]) {
628                            targetBreakpoint = _.breakpoints[breakpoint];
629                        }
630                    }
631                }
632            }
633
634            if (targetBreakpoint !== null) {
635                if (_.activeBreakpoint !== null) {
636                    if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) {
637                        _.activeBreakpoint =
638                            targetBreakpoint;
639                        if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
640                            _.unslick(targetBreakpoint);
641                        } else {
642                            _.options = $.extend({}, _.originalSettings,
643                                _.breakpointSettings[
644                                    targetBreakpoint]);
645                            if (initial === true) {
646                                _.currentSlide = _.options.initialSlide;
647                            }
648                            _.refresh(initial);
649                        }
650                        triggerBreakpoint = targetBreakpoint;
651                    }
652                } else {
653                    _.activeBreakpoint = targetBreakpoint;
654                    if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
655                        _.unslick(targetBreakpoint);
656                    } else {
657                        _.options = $.extend({}, _.originalSettings,
658                            _.breakpointSettings[
659                                targetBreakpoint]);
660                        if (initial === true) {
661                            _.currentSlide = _.options.initialSlide;
662                        }
663                        _.refresh(initial);
664                    }
665                    triggerBreakpoint = targetBreakpoint;
666                }
667            } else {
668                if (_.activeBreakpoint !== null) {
669                    _.activeBreakpoint = null;
670                    _.options = _.originalSettings;
671                    if (initial === true) {
672                        _.currentSlide = _.options.initialSlide;
673                    }
674                    _.refresh(initial);
675                    triggerBreakpoint = targetBreakpoint;
676                }
677            }
678
679            // only trigger breakpoints during an actual break. not on initialize.
680            if( !initial && triggerBreakpoint !== false ) {
681                _.$slider.trigger('breakpoint', [_, triggerBreakpoint]);
682            }
683        }
684
685    };
686
687    Slick.prototype.changeSlide = function(event, dontAnimate) {
688
689        var _ = this,
690            $target = $(event.currentTarget),
691            indexOffset, slideOffset, unevenOffset;
692
693        // If target is a link, prevent default action.
694        if($target.is('a')) {
695            event.preventDefault();
696        }
697
698        // If target is not the <li> element (ie: a child), find the <li>.
699        if(!$target.is('li')) {
700            $target = $target.closest('li');
701        }
702
703        unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0);
704        indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll;
705
706        switch (event.data.message) {
707
708            case 'previous':
709                slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset;
710                if (_.slideCount > _.options.slidesToShow) {
711                    _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate);
712                }
713                break;
714
715            case 'next':
716                slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset;
717                if (_.slideCount > _.options.slidesToShow) {
718                    _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate);
719                }
720                break;
721
722            case 'index':
723                var index = event.data.index === 0 ? 0 :
724                    event.data.index || $target.index() * _.options.slidesToScroll;
725
726                _.slideHandler(_.checkNavigable(index), false, dontAnimate);
727                $target.children().trigger('focus');
728                break;
729
730            default:
731                return;
732        }
733
734    };
735
736    Slick.prototype.checkNavigable = function(index) {
737
738        var _ = this,
739            navigables, prevNavigable;
740
741        navigables = _.getNavigableIndexes();
742        prevNavigable = 0;
743        if (index > navigables[navigables.length - 1]) {
744            index = navigables[navigables.length - 1];
745        } else {
746            for (var n in navigables) {
747                if (index < navigables[n]) {
748                    index = prevNavigable;
749                    break;
750                }
751                prevNavigable = navigables[n];
752            }
753        }
754
755        return index;
756    };
757
758    Slick.prototype.cleanUpEvents = function() {
759
760        var _ = this;
761
762        if (_.options.dots && _.$dots !== null) {
763
764            $('li', _.$dots)
765                .off('click.slick', _.changeSlide)
766                .off('mouseenter.slick', $.proxy(_.interrupt, _, true))
767                .off('mouseleave.slick', $.proxy(_.interrupt, _, false));
768
769        }
770
771        _.$slider.off('focus.slick blur.slick');
772
773        if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
774            _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide);
775            _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide);
776        }
777
778        _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler);
779        _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler);
780        _.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
781        _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler);
782
783        _.$list.off('click.slick', _.clickHandler);
784
785        $(document).off(_.visibilityChange, _.visibility);
786
787        _.cleanUpSlideEvents();
788
789        if (_.options.accessibility === true) {
790            _.$list.off('keydown.slick', _.keyHandler);
791        }
792
793        if (_.options.focusOnSelect === true) {
794            $(_.$slideTrack).children().off('click.slick', _.selectHandler);
795        }
796
797        $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange);
798
799        $(window).off('resize.slick.slick-' + _.instanceUid, _.resize);
800
801        $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault);
802
803        $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition);
804        $(document).off('ready.slick.slick-' + _.instanceUid, _.setPosition);
805
806    };
807
808    Slick.prototype.cleanUpSlideEvents = function() {
809
810        var _ = this;
811
812        _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true));
813        _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false));
814
815    };
816
817    Slick.prototype.cleanUpRows = function() {
818
819        var _ = this, originalSlides;
820
821        if(_.options.rows > 1) {
822            originalSlides = _.$slides.children().children();
823            originalSlides.removeAttr('style');
824            _.$slider.empty().append(originalSlides);
825        }
826
827    };
828
829    Slick.prototype.clickHandler = function(event) {
830
831        var _ = this;
832
833        if (_.shouldClick === false) {
834            event.stopImmediatePropagation();
835            event.stopPropagation();
836            event.preventDefault();
837        }
838
839    };
840
841    Slick.prototype.destroy = function(refresh) {
842
843        var _ = this;
844
845        _.autoPlayClear();
846
847        _.touchObject = {};
848
849        _.cleanUpEvents();
850
851        $('.slick-cloned', _.$slider).detach();
852
853        if (_.$dots) {
854            _.$dots.remove();
855        }
856
857
858        if ( _.$prevArrow && _.$prevArrow.length ) {
859
860            _.$prevArrow
861                .removeClass('slick-disabled slick-arrow slick-hidden')
862                .removeAttr('aria-hidden aria-disabled tabindex')
863                .css('display','');
864
865            if ( _.htmlExpr.test( _.options.prevArrow )) {
866                _.$prevArrow.remove();
867            }
868        }
869
870        if ( _.$nextArrow && _.$nextArrow.length ) {
871
872            _.$nextArrow
873                .removeClass('slick-disabled slick-arrow slick-hidden')
874                .removeAttr('aria-hidden aria-disabled tabindex')
875                .css('display','');
876
877            if ( _.htmlExpr.test( _.options.nextArrow )) {
878                _.$nextArrow.remove();
879            }
880
881        }
882
883
884        if (_.$slides) {
885
886            _.$slides
887                .removeClass('slick-slide slick-active slick-center slick-visible slick-current')
888                .removeAttr('aria-hidden')
889                .removeAttr('data-slick-index')
890                .each(function(){
891                    $(this).attr('style', $(this).data('originalStyling'));
892                });
893
894            _.$slideTrack.children(this.options.slide).detach();
895
896            _.$slideTrack.detach();
897
898            _.$list.detach();
899
900            _.$slider.append(_.$slides);
901        }
902
903        _.cleanUpRows();
904
905        _.$slider.removeClass('slick-slider');
906        _.$slider.removeClass('slick-initialized');
907        _.$slider.removeClass('slick-dotted');
908
909        _.unslicked = true;
910
911        if(!refresh) {
912            _.$slider.trigger('destroy', [_]);
913        }
914
915    };
916
917    Slick.prototype.disableTransition = function(slide) {
918
919        var _ = this,
920            transition = {};
921
922        transition[_.transitionType] = '';
923
924        if (_.options.fade === false) {
925            _.$slideTrack.css(transition);
926        } else {
927            _.$slides.eq(slide).css(transition);
928        }
929
930    };
931
932    Slick.prototype.fadeSlide = function(slideIndex, callback) {
933
934        var _ = this;
935
936        if (_.cssTransitions === false) {
937
938            _.$slides.eq(slideIndex).css({
939                zIndex: _.options.zIndex
940            });
941
942            _.$slides.eq(slideIndex).animate({
943                opacity: 1
944            }, _.options.speed, _.options.easing, callback);
945
946        } else {
947
948            _.applyTransition(slideIndex);
949
950            _.$slides.eq(slideIndex).css({
951                opacity: 1,
952                zIndex: _.options.zIndex
953            });
954
955            if (callback) {
956                setTimeout(function() {
957
958                    _.disableTransition(slideIndex);
959
960                    callback.call();
961                }, _.options.speed);
962            }
963
964        }
965
966    };
967
968    Slick.prototype.fadeSlideOut = function(slideIndex) {
969
970        var _ = this;
971
972        if (_.cssTransitions === false) {
973
974            _.$slides.eq(slideIndex).animate({
975                opacity: 0,
976                zIndex: _.options.zIndex - 2
977            }, _.options.speed, _.options.easing);
978
979        } else {
980
981            _.applyTransition(slideIndex);
982
983            _.$slides.eq(slideIndex).css({
984                opacity: 0,
985                zIndex: _.options.zIndex - 2
986            });
987
988        }
989
990    };
991
992    Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) {
993
994        var _ = this;
995
996        if (filter !== null) {
997
998            _.$slidesCache = _.$slides;
999
1000            _.unload();
1001
1002            _.$slideTrack.children(this.options.slide).detach();
1003
1004            _.$slidesCache.filter(filter).appendTo(_.$slideTrack);
1005
1006            _.reinit();
1007
1008        }
1009
1010    };
1011
1012    Slick.prototype.focusHandler = function() {
1013
1014        var _ = this;
1015
1016        _.$slider
1017            .off('focus.slick blur.slick')
1018            .on('focus.slick blur.slick',
1019                '*:not(.slick-arrow)', function(event) {
1020
1021            event.stopImmediatePropagation();
1022            var $sf = $(this);
1023
1024            setTimeout(function() {
1025
1026                if( _.options.pauseOnFocus ) {
1027                    _.focussed = $sf.is(':focus');
1028                    _.autoPlay();
1029                }
1030
1031            }, 0);
1032
1033        });
1034    };
1035
1036    Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() {
1037
1038        var _ = this;
1039        return _.currentSlide;
1040
1041    };
1042
1043    Slick.prototype.getDotCount = function() {
1044
1045        var _ = this;
1046
1047        var breakPoint = 0;
1048        var counter = 0;
1049        var pagerQty = 0;
1050
1051        if (_.options.infinite === true) {
1052            while (breakPoint < _.slideCount) {
1053                ++pagerQty;
1054                breakPoint = counter + _.options.slidesToScroll;
1055                counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
1056            }
1057        } else if (_.options.centerMode === true) {
1058            pagerQty = _.slideCount;
1059        } else if(!_.options.asNavFor) {
1060            pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll);
1061        }else {
1062            while (breakPoint < _.slideCount) {
1063                ++pagerQty;
1064                breakPoint = counter + _.options.slidesToScroll;
1065                counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
1066            }
1067        }
1068
1069        return pagerQty - 1;
1070
1071    };
1072
1073    Slick.prototype.getLeft = function(slideIndex) {
1074
1075        var _ = this,
1076            targetLeft,
1077            verticalHeight,
1078            verticalOffset = 0,
1079            targetSlide;
1080
1081        _.slideOffset = 0;
1082        verticalHeight = _.$slides.first().outerHeight(true);
1083
1084        if (_.options.infinite === true) {
1085            if (_.slideCount > _.options.slidesToShow) {
1086                _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
1087                verticalOffset = (verticalHeight * _.options.slidesToShow) * -1;
1088            }
1089            if (_.slideCount % _.options.slidesToScroll !== 0) {
1090                if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
1091                    if (slideIndex > _.slideCount) {
1092                        _.slideOffset = ((_.options.slidesToShow - (sl
1092ideIndex - _.slideCount)) * _.slideWidth) * -1;
1093                        verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1;
1094                    } else {
1095                        _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1;
1096                        verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1;
1097                    }
1098                }
1099            }
1100        } else {
1101            if (slideIndex + _.options.slidesToShow > _.slideCount) {
1102                _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth;
1103                verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight;
1104            }
1105        }
1106
1107        if (_.slideCount <= _.options.slidesToShow) {
1108            _.slideOffset = 0;
1109            verticalOffset = 0;
1110        }
1111
1112        if (_.options.centerMode === true && _.options.infinite === true) {
1113            _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
1114        } else if (_.options.centerMode === true) {
1115            _.slideOffset = 0;
1116            _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2);
1117        }
1118
1119        if (_.options.vertical === false) {
1120            targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset;
1121        } else {
1122            targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset;
1123        }
1124
1125        if (_.options.variableWidth === true) {
1126
1127            if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
1128                targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
1129            } else {
1130                targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow);
1131            }
1132
1133            if (_.options.rtl === true) {
1134                if (targetSlide[0]) {
1135                    targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1;
1136                } else {
1137                    targetLeft =  0;
1138                }
1139            } else {
1140                targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
1141            }
1142
1143            if (_.options.centerMode === true) {
1144                if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
1145                    targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
1146                } else {
1147                    targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1);
1148                }
1149
1150                if (_.options.rtl === true) {
1151                    if (targetSlide[0]) {
1152                        targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1;
1153                    } else {
1154                        targetLeft =  0;
1155                    }
1156                } else {
1157                    targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
1158                }
1159
1160                targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2;
1161            }
1162        }
1163
1164        return targetLeft;
1165
1166    };
1167
1168    Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) {
1169
1170        var _ = this;
1171
1172        return _.options[option];
1173
1174    };
1175
1176    Slick.prototype.getNavigableIndexes = function() {
1177
1178        var _ = this,
1179            breakPoint = 0,
1180            counter = 0,
1181            indexes = [],
1182            max;
1183
1184        if (_.options.infinite === false) {
1185            max = _.slideCount;
1186        } else {
1187            breakPoint = _.options.slidesToScroll * -1;
1188            counter = _.options.slidesToScroll * -1;
1189            max = _.slideCount * 2;
1190        }
1191
1192        while (breakPoint < max) {
1193            indexes.push(breakPoint);
1194            breakPoint = counter + _.options.slidesToScroll;
1195            counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
1196        }
1197
1198        return indexes;
1199
1200    };
1201
1202    Slick.prototype.getSlick = function() {
1203
1204        return this;
1205
1206    };
1207
1208    Slick.prototype.getSlideCount = function() {
1209
1210        var _ = this,
1211            slidesTraversed, swipedSlide, centerOffset;
1212
1213        centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0;
1214
1215        if (_.options.swipeToSlide === true) {
1216            _.$slideTrack.find('.slick-slide').each(function(index, slide) {
1217                if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) {
1218                    swipedSlide = slide;
1219                    return false;
1220                }
1221            });
1222
1223            slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1;
1224
1225            return slidesTraversed;
1226
1227        } else {
1228            return _.options.slidesToScroll;
1229        }
1230
1231    };
1232
1233    Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) {
1234
1235        var _ = this;
1236
1237        _.changeSlide({
1238            data: {
1239                message: 'index',
1240                index: parseInt(slide)
1241            }
1242        }, dontAnimate);
1243
1244    };
1245
1246    Slick.prototype.init = function(creation) {
1247
1248        var _ = this;
1249
1250        if (!$(_.$slider).hasClass('slick-initialized')) {
1251
1252            $(_.$slider).addClass('slick-initialized');
1253
1254            _.buildRows();
1255            _.buildOut();
1256            _.setProps();
1257            _.startLoad();
1258            _.loadSlider();
1259            _.initializeEvents();
1260            _.updateArrows();
1261            _.updateDots();
1262            _.checkResponsive(true);
1263            _.focusHandler();
1264
1265        }
1266
1267        if (creation) {
1268            _.$slider.trigger('init', [_]);
1269        }
1270
1271        if (_.options.accessibility === true) {
1272            _.initADA();
1273        }
1274
1275        if ( _.options.autoplay ) {
1276
1277            _.paused = false;
1278            _.autoPlay();
1279
1280        }
1281
1282    };
1283
1284    Slick.prototype.initADA = function() {
1285        var _ = this;
1286        var currentIdSet;
1287        var slideId;
1288        var slideLabelledBy;
1289
1290        _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) {
1291            $(this).attr('role', 'option');
1292
1293            //Evenly distribute aria-labelledby tags through available dots.
1294            var labelledBySlideId = _.options.centerMode ? i : Math.floor(i / _.options.slidesToShow);
1295
1296            if (_.options.dots === true) {
1297                slideId = '' + _.instanceUid + labelledBySlideId;
1298                slideLabelledBy = slideId;
1299
1300                // Prevent duplicate slide IDs by appending index
1301                if (currentIdSet === slideId) {
1302                    slideId = '' + slideId + i;
1303                }
1304
1305                $(this)
1306                    .attr('id', 'slickSlide' + slideId)
1307                    .attr('role', 'tabpanel')
1308                    .attr('aria-labelledby', 'slickDot' + slideLabelledBy);
1309
1310                currentIdSet = '' + _.instanceUid + labelledBySlideId;
1311            }
1312        });
1313
1314        if (_.$dots !== null) {
1315            _.$dots.attr('role', 'tablist').find('li').each(function(i) {
1316                $(this).attr({
1317                    'role': 'tab',
1318                    'aria-selected': 'false',
1319                    'aria-controls': 'slickSlide' + _.instanceUid + i,
1320                    'id': 'slickDot' + _.instanceUid + i + ''
1321                });
1322            })
1323                .first().attr('aria-selected', 'true');
1324        }
1325        _.activateADA();
1326
1327    };
1328
1329    Slick.prototype.updateADA = function() {
1330        var _ = this;
1331
1332        if (_.$dots !== null) {
1333            _.$dots.find('li').attr('aria-selected', 'false');
1334            _.$dots.find('.slick-active').attr('aria-selected', 'true');
1335        }
1336
1337        _.activateADA();
1338    };
1339
1340    Slick.prototype.initArrowEvents = function() {
1341
1342        var _ = this;
1343
1344        if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
1345            _.$prevArrow
1346               .off('click.slick')
1347               .on('click.slick', {
1348                    message: 'previous'
1349               }, _.changeSlide);
1350            _.$nextArrow
1351               .off('click.slick')
1352               .on('click.slick', {
1353                    message: 'next'
1354               }, _.changeSlide);
1355        }
1356
1357    };
1358
1359    Slick.prototype.initDotEvents = function() {
1360
1361        var _ = this;
1362
1363        if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
1364            $('li', _.$dots).on('click.slick', {
1365                message: 'index'
1366            }, _.changeSlide);
1367        }
1368
1369        if ( _.options.dots === true && _.options.pauseOnDotsHover === true ) {
1370
1371            $('li', _.$dots)
1372                .on('mouseenter.slick', $.proxy(_.interrupt, _, true))
1373                .on('mouseleave.slick', $.proxy(_.interrupt, _, false));
1374
1375        }
1376
1377    };
1378
1379    Slick.prototype.initSlideEvents = function() {
1380
1381        var _ = this;
1382
1383        if ( _.options.pauseOnHover ) {
1384
1385            _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true));
1386            _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false));
1387
1388        }
1389
1390    };
1391
1392    Slick.prototype.initializeEvents = function() {
1393
1394        var _ = this;
1395
1396        _.initArrowEvents();
1397
1398        _.initDotEvents();
1399        _.initSlideEvents();
1400
1401        _.$list.on('touchstart.slick mousedown.slick', {
1402            action: 'start'
1403        }, _.swipeHandler);
1404        _.$list.on('touchmove.slick mousemove.slick', {
1405            action: 'move'
1406        }, _.swipeHandler);
1407        _.$list.on('touchend.slick mouseup.slick', {
1408            action: 'end'
1409        }, _.swipeHandler);
1410        _.$list.on('touchcancel.slick mouseleave.slick', {
1411            action: 'end'
1412        }, _.swipeHandler);
1413
1414        _.$list.on('click.slick', _.clickHandler);
1415
1416        $(document).on(_.visibilityChange, $.proxy(_.visibility, _));
1417
1418        if (_.options.accessibility === true) {
1419            _.$list.on('keydown.slick', _.keyHandler);
1420        }
1421
1422        if (_.options.focusOnSelect === true) {
1423            $(_.$slideTrack).children().on('click.slick', _.selectHandler);
1424        }
1425
1426        $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _));
1427
1428        $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _));
1429
1430        $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault);
1431
1432        $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition);
1433        $(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition);
1434
1435    };
1436
1437    Slick.prototype.initUI = function() {
1438
1439        var _ = this;
1440
1441        if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
1442
1443            _.$prevArrow.show();
1444            _.$nextArrow.show();
1445
1446        }
1447
1448        if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
1449
1450            _.$dots.show();
1451
1452        }
1453
1454    };
1455
1456    Slick.prototype.keyHandler = function(event) {
1457
1458        var _ = this;
1459         //Dont slide if the cursor is inside the form fields and arrow keys are pressed
1460        if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) {
1461            if (event.keyCode === 37 && _.options.accessibility === true) {
1462                _.changeSlide({
1463                    data: {
1464                        message: _.options.rtl === true ? 'next' :  'previous'
1465                    }
1466                });
1467            } else if (event.keyCode === 39 && _.options.accessibility === true) {
1468                _.changeSlide({
1469                    data: {
1470                        message: _.options.rtl === true ? 'previous' : 'next'
1471                    }
1472                });
1473            }
1474        }
1475
1476    };
1477
1478    Slick.prototype.lazyLoad = function() {
1479
1480        var _ = this,
1481            loadRange, cloneRange, rangeStart, rangeEnd;
1482
1483        function loadImages(imagesScope) {
1484
1485            $('img[data-lazy]', imagesScope).each(function() {
1486
1487                var image = $(this),
1488                    imageSource = $(this).attr('data-lazy'),
1489                    imageToLoad = document.createElement('img');
1490
1491                imageToLoad.onload = function() {
1492
1493                    image
1494                        .animate({ opacity: 0 }, 100, function() {
1495                            image
1496                                .attr('src', imageSource)
1497                                .animate({ opacity: 1 }, 200, function() {
1498                                    image
1499                                        .removeAttr('data-lazy')
1500                                        .removeClass('slick-loading');
1501                                });
1502                            _.$slider.trigger('lazyLoaded', [_, image, imageSource]);
1503                        });
1504
1505                };
1506
1507                imageToLoad.onerror = function() {
1508
1509                    image
1510                        .removeAttr( 'data-lazy' )
1511                        .removeClass( 'slick-loading' )
1512                        .addClass( 'slick-lazyload-error' );
1513
1514                    _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]);
1515
1516                };
1517
1518                imageToLoad.src = imageSource;
1519
1520            });
1521
1522        }
1523
1524        if (_.options.centerMode === true) {
1525            if (_.options.infinite === true) {
1526                rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1);
1527                rangeEnd = rangeStart + _.options.slidesToShow + 2;
1528            } else {
1529                rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1));
1530                rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide;
1531            }
1532        } else {
1533            rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide;
1534            rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow);
1535            if (_.options.fade === true) {
1536                if (rangeStart > 0) rangeStart--;
1537                if (rangeEnd <= _.slideCount) rangeEnd++;
1538            }
1539        }
1540
1541        loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd);
1542        loadImages(loadRange);
1543
1544        if (_.slideCount <= _.options.slidesToShow) {
1545            cloneRange = _.$slider.find('.slick-slide');
1546            loadImages(cloneRange);
1547        } else
1548        if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
1549            cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow);
1550            loadImages(cloneRange);
1551        } else if (_.currentSlide === 0) {
1552            cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1);
1553            loadImages(cloneRange);
1554        }
1555
1556    };
1557
1558    Slick.prototype.loadSlider = function() {
1559
1560        var _ = this;
1561
1562        _.setPosition();
1563
1564        _.$slideTrack.css({
1565            opacity: 1
1566        });
1567
1568        _.$slider.removeClass('slick-loading');
1569
1570        _.initUI();
1571
1572        if (_.options.lazyLoad === 'progressive') {
1573            _.progressiveLazyLoad();
1574        }
1575
1576    };
1577
1578    Slick.prototype.next = Slick.prototype.slickNext = function() {
1579
1580        var _ = this;
1581
1582        _.changeSlide({
1583            data: {
1584                message: 'next'
1585            }
1586        });
1587
1588    };
1589
1590    Slick.prototype.orientationChange = function() {
1591
1592        var _ = this;
1593
1594        _.checkResponsive();
1595        _.setPosition();
1596
1597    };
1598
1599    Slick.prototype.pause = Slick.prototype.slickPause = function() {
1600
1601        var _ = this;
1602
1603        _.autoPlayClear();
1604        _.paused = true;
1605
1606    };
1607
1608    Slick.prototype.play = Slick.prototype.slickPlay = function() {
1609
1610        var _ = this;
1611
1612        _.autoPlay();
1613        _.options.autoplay = true;
1614        _.paused = false;
1615        _.focussed = false;
1616        _.interrupted = false;
1617
1618    };
1619
1620    Slick.prototype.postSlide = function(index) {
1621
1622        var _ = this;
1623
1624        if( !_.unslicked ) {
1625
1626            _.$slider.trigger('afterChange', [_, index]);
1627
1628            _.animating = false;
1629
1630            _.setPosition();
1631
1632            _.swipeLeft = null;
1633
1634            if ( _.options.autoplay ) {
1635                _.autoPlay();
1636            }
1637
1638            if (_.options.accessibility === true) {
1639                _.updateADA();
1640            }
1641
1642        }
1643
1644    };
1645
1646    Slick.prototype.prev = Slick.prototype.slickPrev = function() {
1647
1648        var _ = this;
1649
1650        _.changeSlide({
1651            data: {
1652                message: 'previous'
1653            }
1654        });
1655
1656    };
1657
1658    Slick.prototype.preventDefault = function(event) {
1659
1660        event.preventDefault();
1661
1662    };
1663
1664    Slick.prototype.progressiveLazyLoad = function( tryCount ) {
1665
1666        tryCount = tryCount || 1;
1667
1668        var _ = this,
1669            $imgsToLoad = $( 'img[data-lazy]', _.$slider ),
1670            image,
1671            imageSource,
1672            imageToLoad;
1673
1674        if ( $imgsToLoad.length ) {
1675
1676            image = $imgsToLoad.first();
1677            imageSource = image.attr('data-lazy');
1678            imageToLoad = document.createElement('img');
1679
1680            imageToLoad.onload = function() {
1681
1682                image
1683                    .attr( 'src', imageSource )
1684                    .removeAttr('data-lazy')
1685                    .removeClass('slick-loading');
1686
1687                if ( _.options.adaptiveHeight === true ) {
1688                    _.setPosition();
1689                }
1690
1691                _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]);
1692                _.progressiveLazyLoad();
1693
1694            };
1695
1696            imageToLoad.onerror = function() {
1697
1698                if ( tryCount < 3 ) {
1699
1700                    /**
1701                     * try to load the image 3 times,
1702                     * leave a slight delay so we don't get
1703                     * servers blocking the request.
1704                     */
1705                    setTimeout( function() {
1706                        _.progressiveLazyLoad( tryCount + 1 );
1707                    }, 500 );
1708
1709                } else {
1710
1711                    image
1712                        .removeAttr( 'data-lazy' )
1713                        .removeClass( 'slick-loading' )
1714                        .addClass( 'slick-lazyload-error' );
1715
1716                    _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]);
1717
1718                    _.progressiveLazyLoad();
1719
1720                }
1721
1722            };
1723
1724            imageToLoad.src = imageSource;
1725
1726        } else {
1727
1728            _.$slider.trigger('allImagesLoaded', [ _ ]);
1729
1730        }
1731
1732    };
1733
1734    Slick.prototype.refresh = function( initializing ) {
1735
1736        var _ = this, currentSlide, lastVisibleIndex;
1737
1738        lastVisibleIndex = _.slideCount - _.options.slidesToShow;
1739
1740        // in non-infinite sliders, we don't want to go past the
1741        // last visible index.
1742        if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) {
1743            _.currentSlide = lastVisibleIndex;
1744        }
1745
1746        // if less slides than to show, go to start.
1747        if ( _.slideCount <= _.options.slidesToShow ) {
1748            _.currentSlide = 0;
1749
1750        }
1751
1752        currentSlide = _.currentSlide;
1753
1754        _.destroy(true);
1755
1756        $.extend(_, _.initials, { currentSlide: currentSlide });
1757
1758        _.init();
1759
1760        if( !initializing ) {
1761
1762            _.changeSlide({
1763                data: {
1764                    message: 'index',
1765                    index: currentSlide
1766                }
1767            }, false);
1768
1769        }
1770
1771    };
1772
1773    Slick.prototype.registerBreakpoints = function() {
1774
1775        var _ = this, breakpoint, currentBreakpoint, l,
1776            responsiveSettings = _.options.responsive || null;
1777
1778        if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) {
1779
1780            _.respondTo = _.options.respondTo || 'window';
1781
1782            for ( breakpoint in responsiveSettings ) {
1783
1784                l = _.breakpoints.length-1;
1785                currentBreakpoint = responsiveSettings[breakpoint].breakpoint;
1786
1787                if (responsiveSettings.hasOwnProperty(breakpoint)) {
1788
1789                    // loop through the breakpoints and cut out any existing
1790                    // ones with the same breakpoint number, we don't want dupes.
1791                    while( l >= 0 ) {
1792                        if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) {
1793                            _.breakpoints.splice(l,1);
1794                        }
1795                        l--;
1796                    }
1797
1798                    _.breakpoints.push(currentBreakpoint);
1799                    _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings;
1800
1801                }
1802
1803            }
1804
1805            _.breakpoints.sort(function(a, b) {
1806                return ( _.options.mobileFirst ) ? a-b : b-a;
1807            });
1808
1809        }
1810
1811    };
1812
1813    Slick.prototype.reinit = function() {
1814
1815        var _ = this;
1816
1817        _.$slides =
1818            _.$slideTrack
1819                .children(_.options.slide)
1820                .addClass('slick-slide');
1821
1822        _.slideCount = _.$slides.length;
1823
1824        if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) {
1825            _.currentSlide = _.currentSlide - _.options.slidesToScroll;
1826        }
1827
1828        if (_.slideCount <= _.options.slidesToShow) {
1829            _.currentSlide = 0;
1830        }
1831
1832        _.registerBreakpoints();
1833
1834        _.setProps();
1835        _.setupInfinite();
1836        _.buildArrows();
1837        _.updateArrows();
1838        _.initArrowEvents();
1839        _.buildDots();
1840        _.updateDots();
1841        _.initDotEvents();
1842        _.cleanUpSlideEvents();
1843        _.initSlideEvents();
1844
1845        _.checkResponsive(false, true);
1846
1847        if (_.options.focusOnSelect === true) {
1848            $(_.$slideTrack).children().on('click.slick', _.selectHandler);
1849        }
1850
1851        _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);
1852
1853        _.setPosition();
1854        _.focusHandler();
1855
1856        _.paused = !_.options.autoplay;
1857        _.autoPlay();
1858
1859        _.$slider.trigger('reInit', [_]);
1860
1861    };
1862
1863    Slick.prototype.resize = function() {
1864
1865        var _ = this;
1866
1867        if ($(window).width() !== _.windowWidth) {
1868            clearTimeout(_.windowDelay);
1869            _.windowDelay = window.setTimeout(function() {
1870                _.windowWidth = $(window).width();
1871                _.checkResponsive();
1872                if( !_.unslicked ) { _.setPosition(); }
1873            }, 50);
1874        }
1875    };
1876
1877    Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) {
1878
1879        var _ = this;
1880
1881        if (typeof(index) === 'boolean') {
1882            removeBefore = index;
1883            index = removeBefore === true ? 0 : _.slideCount - 1;
1884        } else {
1885            index = removeBefore === true ? --index : index;
1886        }
1887
1888        if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) {
1889            return false;
1890        }
1891
1892        _.unload();
1893
1894        if (removeAll === true) {
1895            _.$slideTrack.children().remove();
1896        } else {
1897            _.$slideTrack.children(this.options.slide).eq(index).remove();
1898        }
1899
1900        _.$slides = _.$slideTrack.children(this.options.slide);
1901
1902        _.$slideTrack.children(this.options.slide).detach();
1903
1904        _.$slideTrack.append(_.$slides);
1905
1906        _.$slidesCache = _.$slides;
1907
1908        _.reinit();
1909
1910    };
1911
1912    Slick.prototype.setCSS = function(position) {
1913
1914        var _ = this,
1915            positionProps = {},
1916            x, y;
1917
1918        if (_.options.rtl === true) {
1919            position = -position;
1920        }
1921        x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px';
1922        y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px';
1923
1924        positionProps[_.positionProp] = position;
1925
1926        if (_.transformsEnabled === false) {
1927            _.$slideTrack.css(positionProps);
1928        } else {
1929            positionProps = {};
1930            if (_.cssTransitions === false) {
1931                positionProps[_.animType] = 'translate(' + x + ', ' + y + ')';
1932                _.$slideTrack.css(positionProps);
1933            } else {
1934                positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)';
1935                _.$slideTrack.css(positionProps);
1936            }
1937        }
1938
1939    };
1940
1941    Slick.prototype.setDimensions = function() {
1942
1943        var _ = this;
1944
1945        if (_.options.vertical === false) {
1946            if (_.options.centerMode === true) {
1947                _.$list.css({
1948                    padding: ('0px ' + _.options.centerPadding)
1949                });
1950            }
1951        } else {
1952            _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow);
1953            if (_.options.centerMode === true) {
1954                _.$list.css({
1955                    padding: (_.options.centerPadding + ' 0px')
1956                });
1957            }
1958        }
1959
1960        _.listWidth = _.$list.width();
1961        _.listHeight = _.$list.height();
1962
1963
1964        if (_.options.vertical === false && _.options.variableWidth === false) {
1965            _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow);
1966            _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length)));
1967
1968        } else if (_.options.variableWidth === true) {
1969            _.$slideTrack.width(5000 * _.slideCount);
1970        } else {
1971            _.slideWidth = Math.ceil(_.listWidth);
1972            _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length)));
1973        }
1974
1975        var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width();
1976        if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset);
1977
1978    };
1979
1980    Slick.prototype.setFade = function() {
1981
1982        var _ = this,
1983            targetLeft;
1984
1985        _.$slides.each(function(index, element) {
1986            targetLeft = (_.slideWidth * index) * -1;
1987            if (_.options.rtl === true) {
1988                $(element).css({
1989                    position: 'relative',
1990                    right: targetLeft,
1991                    top: 0,
1992                    zIndex: _.options.zIndex - 2,
1993                    opacity: 0
1994                });
1995            } else {
1996                $(element).css({
1997                    position: 'relative',
1998                    left: targetLeft,
1999                    top: 0,
2000                    zIndex: _.options.zIndex - 2,
2001                    opacity: 0
2002                });
2003            }
2004        });
2005
2006        _.$slides.eq(_.currentSlide).css({
2007            zIndex: _.options.zIndex - 1,
2008            opacity: 1
2009        });
2010
2011    };
2012
2013    Slick.prototype.setHeight = function() {
2014
2015        var _ = this;
2016
2017        if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
2018            var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
2019            _.$list.css('height', targetHeight);
2020        }
2021
2022    };
2023
2024    Slick.prototype.setOption =
2025    Slick.prototype.slickSetOption = function() {
2026
2027        /**
2028         * accepts arguments in format of:
2029         *
2030         *  - for changing a single option's value:
2031         *     .slick("setOption", option, value, refresh )
2032         *
2033         *  - for changing a set of responsive options:
2034         *     .slick("setOption", 'responsive', [{}, ...], refresh )
2035         *
2036         *  - for updating multiple values at once (not responsive)
2037         *     .slick("setOption", { 'option': value, ... }, refresh )
2038         */
2039
2040        var _ = this, l, item, option, value, refresh = false, type;
2041
2042        if( $.type( arguments[0] ) === 'object' ) {
2043
2044            option =  arguments[0];
2045            refresh = arguments[1];
2046            type = 'multiple';
2047
2048        } else if ( $.type( arguments[0] ) === 'string' ) {
2049
2050            option =  arguments[0];
2051            value = arguments[1];
2052            refresh = arguments[2];
2053
2054            if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) {
2055
2056                type = 'responsive';
2057
2058            } else if ( typeof arguments[1] !== 'undefined' ) {
2059
2060                type = 'single';
2061
2062            }
2063
2064        }
2065
2066        if ( type === 'single' ) {
2067
2068            _.options[option] = value;
2069
2070
2071        } else if ( type === 'multiple' ) {
2072
2073            $.each( option , function( opt, val ) {
2074
2075                _.options[opt] = val;
2076
2077            });
2078
2079
2080        } else if ( type === 'responsive' ) {
2081
2082            for ( item in value ) {
2083
2084                if( $.type( _.options.responsive ) !== 'array' ) {
2085
2086                    _.options.responsive = [ value[item] ];
2087
2088                } else {
2089
2090                    l = _.options.responsive.length-1;
2091
2092                    // loop through the responsive object and splice out duplicates.
2093                    while( l >= 0 ) {
2094
2095                        if( _.options.responsive[l].breakpoint === value[item].breakpoint ) {
2096
2097                            _.options.responsive.splice(l,1);
2098
2099                        }
2100
2101                        l--;
2102
2103                    }
2104
2105                    _.options.responsive.push( value[item] );
2106
2107                }
2108
2109            }
2110
2111        }
2112
2113        if ( refresh ) {
2114
2115            _.unload();
2116            _.reinit();
2117
2118        }
2119
2120    };
2121
2122    Slick.prototype.setPosition = function() {
2123
2124        var _ = this;
2125
2126        _.setDimensions();
2127
2128        _.setHeight();
2129
2130        if (_.options.fade === false) {
2131            _.setCSS(_.getLeft(_.currentSlide));
2132        } else {
2133            _.setFade();
2134        }
2135
2136        _.$slider.trigger('setPosition', [_]);
2137
2138    };
2139
2140    Slick.prototype.setProps = function() {
2141
2142        var _ = this,
2143            bodyStyle = document.body.style;
2144
2145        _.positionProp = _.options.vertical === true ? 'top' : 'left';
2146
2147        if (_.positionProp === 'top') {
2148            _.$slider.addClass('slick-vertical');
2149        } else {
2150            _.$slider.removeClass('slick-vertical');
2151        }
2152
2153        if (bodyStyle.WebkitTransition !== undefined ||
2154            bodyStyle.MozTransition !== undefined ||
2155            bodyStyle.msTransition !== undefined) {
2156            if (_.options.useCSS === true) {
2157                _.cssTransitions = true;
2158            }
2159        }
2160
2161        if ( _.options.fade ) {
2162            if ( typeof _.options.zIndex === 'number' ) {
2163                if( _.options.zIndex < 3 ) {
2164                    _.options.zIndex = 3;
2165                }
2166            } else {
2167                _.options.zIndex = _.defaults.zIndex;
2168            }
2169        }
2170
2171        if (bodyStyle.OTransform !== undefined) {
2172            _.animType = 'OTransform';
2173            _.transformType = '-o-transform';
2174            _.transitionType = 'OTransition';
2175            if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
2176        }
2177        if (bodyStyle.MozTransform !== undefined) {
2178            _.animType = 'MozTransform';
2179            _.transformType = '-moz-transform';
2180            _.transitionType = 'MozTransition';
2181            if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false;
2182        }
2183        if (bodyStyle.webkitTransform !== undefined) {
2184            _.animType = 'webkitTransform';
2185            _.transformType = '-webkit-transform';
2186            _.transitionType = 'webkitTransition';
2187            if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
2188        }
2189        if (bodyStyle.msTransform !== undefined) {
2190            _.animType = 'msTransform';
2191            _.transformType = '-ms-transform';
2192            _.transitionType = 'msTransition';
2193            if (bodyStyle.msTransform === undefined) _.animType = false;
2194        }
2195        if (bodyStyle.transform !== undefined && _.animType !== false) {
2196            _.animType = 'transform';
2197            _.transformType = 'transform';
2198            _.transitionType = 'transition';
2199        }
2200        _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false);
2201    };
2202
2203
2204    Slick.prototype.setSlideClasses = function(index) {
2205
2206        var _ = this,
2207            centerOffset, allSlides, indexOffset, remainder;
2208
2209        allSlides = _.$slider
2210            .find('.slick-slide')
2211            .removeClass('slick-active slick-center slick-current')
2212            .attr('aria-hidden', 'true');
2213
2214        _.$slides
2215            .eq(index)
2216            .addClass('slick-current');
2217
2218        if (_.options.centerMode === true) {
2219
2220            centerOffset = Math.floor(_.options.slidesToShow / 2);
2221
2222            if (_.options.infinite === true) {
2223
2224                if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {
2225
2226                    _.$slides
2227                        .slice(index - centerOffset, index + centerOffset + 1)
2228                        .addClass('slick-active')
2229                        .attr('aria-hidden', 'false');
2230
2231                } else {
2232
2233                    indexOffset = _.options.slidesToShow + index;
2234                    allSlides
2235                        .slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2)
2236                        .addClass('slick-active')
2237                        .attr('aria-hidden', 'false');
2238
2239                }
2240
2241                if (index === 0) {
2242
2243                    allSlides
2244                        .eq(allSlides.length - 1 - _.options.slidesToShow)
2245                        .addClass('slick-center');
2246
2247                } else if (index === _.slideCount - 1) {
2248
2249                    allSlides
2250                        .eq(_.options.slidesToShow)
2251                        .addClass('slick-center');
2252
2253                }
2254
2255            }
2256
2257            _.$slides
2258                .eq(index)
2259                .addClass('slick-center');
2260
2261        } else {
2262
2263            if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) {
2264
2265                _.$slides
2266                    .slice(index, index + _.options.slidesToShow)
2267                    .addClass('slick-active')
2268                    .attr('aria-hidden', 'false');
2269
2270            } else if (allSlides.length <= _.options.slidesToShow) {
2271
2272                allSlides
2273                    .addClass('slick-active')
2274                    .attr('aria-hidden', 'false');
2275
2276            } else {
2277
2278                remainder = _.slideCount % _.options.slidesToShow;
2279                indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index;
2280
2281                if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) {
2282
2283                    allSlides
2284                        .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder)
2285                        .addClass('slick-active')
2286                        .attr('aria-hidden', 'false');
2287
2288                } else {
2289
2290                    allSlides
2291                        .slice(indexOffset, indexOffset + _.options.slidesToShow)
2292                        .addClass('slick-active')
2293                        .attr('aria-hidden', 'false');
2294
2295                }
2296
2297            }
2298
2299        }
2300
2301        if (_.options.lazyLoad === 'ondemand') {
2302            _.lazyLoad();
2303        }
2304
2305    };
2306
2307    Slick.prototype.setupInfinite = function() {
2308
2309        var _ = this,
2310            i, slideIndex, infiniteCount;
2311
2312        if (_.options.fade === true) {
2313            _.options.centerMode = false;
2314        }
2315
2316        if (_.options.infinite === true && _.options.fade === false) {
2317
2318            slideIndex = null;
2319
2320            if (_.slideCount > _.options.slidesToShow) {
2321
2322                if (_.options.centerMode === true) {
2323                    infiniteCount = _.options.slidesToShow + 1;
2324                } else {
2325                    infiniteCount = _.options.slidesToShow;
2326                }
2327
2328                for (i = _.slideCount; i > (_.slideCount -
2329                        infiniteCount); i -= 1) {
2330                    slideIndex = i - 1;
2331                    $(_.$slides[slideIndex]).clone(true).attr('id', '')
2332                        .attr('data-slick-index', slideIndex - _.slideCount)
2333                        .prependTo(_.$slideTrack).addClass('slick-cloned');
2334                }
2335                for (i = 0; i < infiniteCount; i += 1) {
2336                    slideIndex = i;
2337                    $(_.$slides[slideIndex]).clone(true).attr('id', '')
2338                        .attr('data-slick-index', slideIndex + _.slideCount)
2339                        .appendTo(_.$slideTrack).addClass('slick-cloned');
2340                }
2341                _.$slideTrack.find('.slick-cloned').find('[id]').each(function() {
2342                    $(this).attr('id', '');
2343                });
2344
2345            }
2346
2347        }
2348
2349    };
2350
2351    Slick.prototype.interrupt = function( toggle ) {
2352
2353        var _ = this;
2354
2355        if( !toggle ) {
2356            _.autoPlay();
2357        }
2358        _.interrupted = toggle;
2359
2360    };
2361
2362    Slick.prototype.selectHandler = function(event) {
2363
2364        var _ = this;
2365
2366        var targetElement =
2367            $(event.target).is('.slick-slide') ?
2368                $(event.target) :
2369                $(event.target).parents('.slick-slide');
2370
2371        var index = parseInt(targetElement.attr('data-slick-index'));
2372
2373        if (!index) index = 0;
2374
2375        if (_.slideCount <= _.options.slidesToShow) {
2376
2377            _.setSlideClasses(index);
2378            _.asNavFor(index);
2379            return;
2380
2381        }
2382
2383        _.slideHandler(index);
2384
2385    };
2386
2387    Slick.prototype.slideHandler = function(index, sync, dontAnimate) {
2388
2389        var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null,
2390            _ = this, navTarget;
2391
2392        sync = sync || false;
2393
2394        if (_.animating === true && _.options.waitForAnimate === true) {
2395            return;
2396        }
2397
2398        if (_.options.fade === true && _.currentSlide === index) {
2399            return;
2400        }
2401
2402        if (_.slideCount <= _.options.slidesToShow) {
2403            return;
2404        }
2405
2406        if (sync === false) {
2407            _.asNavFor(index);
2408        }
2409
2410        targetSlide = index;
2411        targetLeft = _.getLeft(targetSlide);
2412        slideLeft = _.getLeft(_.currentSlide);
2413
2414        _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;
2415
2416        if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) {
2417            if (_.options.fade === false) {
2418                targetSlide = _.currentSlide;
2419                if (dontAnimate !== true) {
2420                    _.animateSlide(slideLeft, function() {
2421                        _.postSlide(targetSlide);
2422                    });
2423                } else {
2424                    _.postSlide(targetSlide);
2425                }
2426            }
2427            return;
2428        } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) {
2429            if (_.options.fade === false) {
2430                targetSlide = _.currentSlide;
2431                if (dontAnimate !== true) {
2432                    _.animateSlide(slideLeft, function() {
2433                        _.postSlide(targetSlide);
2434                    });
2435                } else {
2436                    _.postSlide(targetSlide);
2437                }
2438            }
2439            return;
2440        }
2441
2442        if ( _.options.autoplay ) {
2443            clearInterval(_.autoPlayTimer);
2444        }
2445
2446        if (targetSlide < 0) {
2447            if (_.slideCount % _.options.slidesToScroll !== 0) {
2448                animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll);
2449            } else {
2450                animSlide = _.slideCount + targetSlide;
2451            }
2452        } else if (targetSlide >= _.slideCount) {
2453            if (_.slideCount % _.options.slidesToScroll !== 0) {
2454                animSlide = 0;
2455            } else {
2456                animSlide = targetSlide - _.slideCount;
2457            }
2458        } else {
2459            animSlide = targetSlide;
2460        }
2461
2462        _.animating = true;
2463
2464        _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]);
2465
2466        oldSlide = _.currentSlide;
2467        _.currentSlide = animSlide;
2468
2469        _.setSlideClasses(_.currentSlide);
2470
2471        if ( _.options.asNavFor ) {
2472
2473            navTarget = _.getNavTarget();
2474            navTarget = navTarget.slick('getSlick');
2475
2476            if ( navTarget.slideCount <= navTarget.options.slidesToShow ) {
2477                navTarget.setSlideClasses(_.currentSlide);
2478            }
2479
2480        }
2481
2482        _.updateDots();
2483        _.updateArrows();
2484
2485        if (_.options.fade === true) {
2486            if (dontAnimate !== true) {
2487
2488                _.fadeSlideOut(oldSlide);
2489
2490                _.fadeSlide(animSlide, function() {
2491                    _.postSlide(animSlide);
2492                });
2493
2494            } else {
2495                _.postSlide(animSlide);
2496            }
2497            _.animateHeight();
2498            return;
2499        }
2500
2501        if (dontAnimate !== true) {
2502            _.animateSlide(targetLeft, function() {
2503                _.postSlide(animSlide);
2504            });
2505        } else {
2506            _.postSlide(animSlide);
2507        }
2508
2509    };
2510
2511    Slick.prototype.startLoad = function() {
2512
2513        var _ = this;
2514
2515        if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
2516
2517            _.$prevArrow.hide();
2518            _.$nextArrow.hide();
2519
2520        }
2521
2522        if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
2523
2524            _.$dots.hide();
2525
2526        }
2527
2528        _.$slider.addClass('slick-loading');
2529
2530    };
2531
2532    Slick.prototype.swipeDirection = function() {
2533
2534        var xDist, yDist, r, swipeAngle, _ = this;
2535
2536        xDist = _.touchObject.startX - _.touchObject.curX;
2537        yDist = _.touchObject.startY - _.touchObject.curY;
2538        r = Math.atan2(yDist, xDist);
2539
2540        swipeAngle = Math.round(r * 180 / Math.PI);
2541        if (swipeAngle < 0) {
2542            swipeAngle = 360 - Math.abs(swipeAngle);
2543        }
2544
2545        if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
2546            return (_.options.rtl === false ? 'left' : 'right');
2547        }
2548        if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
2549            return (_.options.rtl === false ? 'left' : 'right');
2550        }
2551        if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
2552            return (_.options.rtl === false ? 'right' : 'left');
2553        }
2554        if (_.options.verticalSwiping === true) {
2555            if ((swipeAngle >= 35) && (swipeAngle <= 135)) {
2556                return 'down';
2557            } else {
2558                return 'up';
2559            }
2560        }
2561
2562        return 'vertical';
2563
2564    };
2565
2566    Slick.prototype.swipeEnd = function(event) {
2567
2568        var _ = this,
2569            slideCount,
2570            direction;
2571
2572        _.dragging = false;
2573        _.interrupted = false;
2574        _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true;
2575
2576        if ( _.touchObject.curX === undefined ) {
2577            return false;
2578        }
2579
2580        if ( _.touchObject.edgeHit === true ) {
2581            _.$slider.trigger('edge', [_, _.swipeDirection() ]);
2582        }
2583
2584        if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) {
2585
2586            direction = _.swipeDirection();
2587
2588            switch ( direction ) {
2589
2590                case 'left':
2591                case 'down':
2592
2593                    slideCount =
2594                        _.options.swipeToSlide ?
2595                            _.checkNavigable( _.currentSlide + _.getSlideCount() ) :
2596                            _.currentSlide + _.getSlideCount();
2597
2598                    _.currentDirection = 0;
2599
2600                    break;
2601
2602                case 'right':
2603                case 'up':
2604
2605                    slideCount =
2606                        _.options.swipeToSlide ?
2607                            _.checkNavigable( _.currentSlide - _.getSlideCount() ) :
2608                            _.currentSlide - _.getSlideCount();
2609
2610                    _.currentDirection = 1;
2611
2612                    break;
2613
2614                default:
2615
2616
2617            }
2618
2619            if( direction != 'vertical' ) {
2620
2621                _.slideHandler( slideCount );
2622                _.touchObject = {};
2623                _.$slider.trigger('swipe', [_, direction ]);
2624
2625            }
2626
2627        } else {
2628
2629            if ( _.touchObject.startX !== _.touchObject.curX ) {
2630
2631                _.slideHandler( _.currentSlide );
2632                _.touchObject = {};
2633
2634            }
2635
2636        }
2637
2638    };
2639
2640    Slick.prototype.swipeHandler = function(event) {
2641
2642        var _ = this;
2643
2644        if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) {
2645            return;
2646        } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) {
2647            return;
2648        }
2649
2650        _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ?
2651            event.originalEvent.touches.length : 1;
2652
2653        _.touchObject.minSwipe = _.listWidth / _.options
2654            .touchThreshold;
2655
2656        if (_.options.verticalSwiping === true) {
2657            _.touchObject.minSwipe = _.listHeight / _.options
2658                .touchThreshold;
2659        }
2660
2661        switch (event.data.action) {
2662
2663            case 'start':
2664                _.swipeStart(event);
2665                break;
2666
2667            case 'move':
2668                _.swipeMove(event);
2669                break;
2670
2671            case 'end':
2672                _.swipeEnd(event);
2673                break;
2674
2675        }
2676
2677    };
2678
2679    Slick.prototype.swipeMove = function(event) {
2680
2681        var _ = this,
2682            edgeWasHit = false,
2683            curLeft, swipeDirection, swipeLength, positionOffset, touches;
2684
2685        touches = event.originalEvent !== undefined ? event.originalEvent.touches : null;
2686
2687        if (!_.dragging || touches && touches.length !== 1) {
2688            return false;
2689        }
2690
2691        curLeft = _.getLeft(_.currentSlide);
2692
2693        _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX;
2694        _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY;
2695
2696        _.touchObject.swipeLength = Math.round(Math.sqrt(
2697            Math.pow(_.touchObject.curX - _.touchObject.startX, 2)));
2698
2699        if (_.options.verticalSwiping === true) {
2700            _.touchObject.swipeLength = Math.round(Math.sqrt(
2701                Math.pow(_.touchObject.curY - _.touchObject.startY, 2)));
2702        }
2703
2704        swipeDirection = _.swipeDirection();
2705
2706        if (swipeDirection === 'vertical') {
2707            return;
2708        }
2709
2710        if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) {
2711            event.preventDefault();
2712        }
2713
2714        positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1);
2715        if (_.options.verticalSwiping === true) {
2716            positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1;
2717        }
2718
2719
2720        swipeLength = _.touchObject.swipeLength;
2721
2722        _.touchObject.edgeHit = false;
2723
2724        if (_.options.infinite === false) {
2725            if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) {
2726                swipeLength = _.touchObject.swipeLength * _.options.edgeFriction;
2727                _.touchObject.edgeHit = true;
2728            }
2729        }
2730
2731        if (_.options.vertical === false) {
2732            _.swipeLeft = curLeft + swipeLength * positionOffset;
2733        } else {
2734            _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset;
2735        }
2736        if (_.options.verticalSwiping === true) {
2737            _.swipeLeft = curLeft + swipeLength * positionOffset;
2738        }
2739
2740        if (_.options.fade === true || _.options.touchMove === false) {
2741            return false;
2742        }
2743
2744        if (_.animating === true) {
2745            _.swipeLeft = null;
2746            return false;
2747        }
2748
2749        _.setCSS(_.swipeLeft);
2750
2751    };
2752
2753    Slick.prototype.swipeStart = function(event) {
2754
2755        var _ = this,
2756            touches;
2757
2758        _.interrupted = true;
2759
2760        if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) {
2761            _.touchObject = {};
2762            return false;
2763        }
2764
2765        if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) {
2766            touches = event.originalEvent.touches[0];
2767        }
2768
2769        _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX;
2770        _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY;
2771
2772        _.dragging = true;
2773
2774    };
2775
2776    Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() {
2777
2778        var _ = this;
2779
2780        if (_.$slidesCache !== null) {
2781
2782            _.unload();
2783
2784            _.$slideTrack.children(this.options.slide).detach();
2785
2786            _.$slidesCache.appendTo(_.$slideTrack);
2787
2788            _.reinit();
2789
2790        }
2791
2792    };
2793
2794    Slick.prototype.unload = function() {
2795
2796        var _ = this;
2797
2798        $('.slick-cloned', _.$slider).remove();
2799
2800        if (_.$dots) {
2801            _.$dots.remove();
2802        }
2803
2804        if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) {
2805            _.$prevArrow.remove();
2806        }
2807
2808        if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) {
2809            _.$nextArrow.remove();
2810        }
2811
2812        _.$slides
2813            .removeClass('slick-slide slick-active slick-visible slick-current')
2814            .attr('aria-hidden', 'true')
2815            .css('width', '');
2816
2817    };
2818
2819    Slick.prototype.unslick = function(fromBreakpoint) {
2820
2821        var _ = this;
2822        _.$slider.trigger('unslick', [_, fromBreakpoint]);
2823        _.destroy();
2824
2825    };
2826
2827    Slick.prototype.updateArrows = function() {
2828
2829        var _ = this,
2830            centerOffset;
2831
2832        centerOffset = Math.floor(_.options.slidesToShow / 2);
2833
2834        if ( _.options.arrows === true &&
2835            _.slideCount > _.options.slidesToShow &&
2836            !_.options.infinite ) {
2837
2838            _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
2839            _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
2840
2841            if (_.currentSlide === 0) {
2842
2843                _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
2844                _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
2845
2846            } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) {
2847
2848                _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
2849                _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
2850
2851            } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) {
2852
2853                _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
2854                _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
2855
2856            }
2857
2858        }
2859
2860    };
2861
2862    Slick.prototype.updateDots = function() {
2863
2864        var _ = this;
2865
2866        if (_.$dots !== null) {
2867
2868            _.$dots
2869                .find('li')
2870                .removeClass('slick-active');
2871
2872            _.$dots
2873                .find('li')
2874                .eq(Math.floor(_.currentSlide / _.options.slidesToScroll))
2875                .addClass('slick-active');
2876
2877        }
2878
2879    };
2880
2881    Slick.prototype.visibility = function() {
2882
2883        var _ = this;
2884
2885        if ( _.options.autoplay ) {
2886
2887            if ( document[_.hidden] ) {
2888
2889                _.interrupted = true;
2890
2891            } else {
2892
2893                _.interrupted = false;
2894
2895            }
2896
2897        }
2898
2899    };
2900
2901    $.fn.slick = function() {
2902        var _ = this,
2903            opt = arguments[0],
2904            args = Array.prototype.slice.call(arguments, 1),
2905            l = _.length,
2906            i,
2907            ret;
2908        for (i = 0; i < l; i++) {
2909            if (typeof opt == 'object' || typeof opt == 'undefined')
2910                _[i].slick = new Slick(_[i], opt);
2911            else
2912                ret = _[i].slick[opt].apply(_[i].slick, args);
2913            if (typeof ret != 'undefined') return ret;
2914        }
2915        return _;
2916    };
2917
2918}));

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.