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