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