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