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