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