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