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