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