PluginProbe
Post Grid Gutenberg Blocks – PostX / 5.1.1
Post Grid Gutenberg Blocks – PostX v5.1.1
5.1.1 5.1.0 5.0.41 5.0.39 5.0.38 5.0.37 5.0.36 5.0.35 5.0.34 5.0.33 5.0.32 5.0.31 5.0.30 5.0.29 5.0.28 5.0.27 5.0.26 5.0.25 5.0.23 5.0.24 5.0.22 5.0.21 5.0.20 5.0.19 5.0.18 All 240 releases
ultimate-post / assets / js / slick.js

slick.js in Post Grid Gutenberg Blocks – PostX 5.1.1, at assets/js/slick.js

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