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