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