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