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