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