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