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