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