Subversion-Projekte lars-tiefland.webanos.marine-sales.de

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

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