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