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