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