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