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