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