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