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