1(function ($) { 2 3 //Fix issues with lock screen on mobile devices. 4 ScrollTrigger.config({ 5 limitCallbacks: true, 6 ignoreMobileResize: true 7 }); 8 9 $(window).on('elementor/frontend/init', function () { 10 var PremiumHorizontalScrollHandler = elementorModules.frontend.handlers.Base.extend({ 11 12 getDefaultSettings: function () { 13 return { 14 selectors: { 15 hScrollElem: '.premium-hscroll-wrap', 16 sectionWrap: '.premium-hscroll-sections-wrap', 17 hscrollTemp: '.premium-hscroll-temp', 18 } 19 } 20 }, 21 22 getDefaultElements: function () { 23 var selectors = this.getSettings('selectors'), 24 elements = { 25 $hScrollElem: this.$element.find(selectors.hScrollElem), 26 }; 27 28 elements.$sectionWrap = elements.$hScrollElem.find(selectors.sectionWrap); 29 elements.$hscrollTemp = elements.$hScrollElem.find(selectors.hscrollTemp); 30 31 return elements; 32 }, 33 34 bindEvents: function () { 35 36 var self = this; 37 38 if ($('.premium-mscroll-yes').length > 0) { 39 40 new Waypoint({ 41 element: this.$element, 42 offset: '100%', 43 handler: function () { 44 self.run(); 45 }, 46 }); 47 48 } else { 49 self.run(); 50 } 51 52 }, 53 54 run: function () { 55 56 var $scope = this.$element, 57 $hScrollElem = this.elements.$hScrollElem, 58 hScrollSettings = $hScrollElem.data("settings"), 59 instance = null, 60 templates = this.getElementSettings('section_repeater'); 61 62 if (!templates.length) return; 63
64 templates.forEach(function (template) { 65 66 if ("id" === template.template_type && "" !== template.section_id) { 67 if ($("#" + template.section_id).length == 0) { 68 $hScrollElem.html( 69 '<div class="premium-error-notice"><span>Section with ID <b>' + 70 template.section_id + 71 "</b> does not exist on this page. Please make sure that section ID is properly set from section settings -> Advanced tab -> CSS ID.<span></div>" 72 ); 73 return; 74 } 75 } 76 }); 77 78 instance = new premiumHorizontalScroll($scope, hScrollSettings, this.getElementSettings()); 79 instance.checkDisableOnOption(); 80 81 }, 82 83 }); 84 85 window.premiumHorizontalScroll = function ($scope, settings, controlSettings) { 86 87 var self = this, 88 $elem = $scope.find('.premium-hscroll-wrap'), 89 id = settings.id, 90 count = controlSettings.section_repeater.length, 91 editMode = elementorFrontend.isEditMode(), 92 currentDevice = elementorFrontend.getCurrentDeviceMode(), 93 progressOffset = 300, 94 currentActiveArr = [], 95 currentActive = 0, 96 prevActive = -1, 97 loop = controlSettings.loop, 98 entrance = controlSettings.entrance_animation, 99 entranceOnce = controlSettings.trigger_animation_once, 100 snapScroll = 'snap' === controlSettings.scroll_effect, 101 isScrolling = false, 102 scene = null, 103 offset = null, 104 timeline = null, 105 rtlMode = controlSettings.rtl_mode, 106 dimensions = null, 107 isActive = false, 108 state = null; 109 110 $elem.find(".premium-hscroll-temp").each(function (index, template) { 111 112 var hideOn = $(template).data('hide'); 113 114 if (-1 < hideOn.indexOf(currentDevice)) { 115 hideSection(template, index); 116 } 117 118 }); 119 120 function hideSection(template, index) { 121 122 if (0 !== count) { 123 count--; 124 $(template).remove(); 125 126 $elem.find('.premium-hscroll-bg-layer').eq(index).remove(); 127 $elem.find('.premium-hscroll-total-slides').html(count > 9 ? count : ('0' + count)); 128 $elem.find('.premium-hscroll-nav-item[data-slide="section_' + id + index + '"]').remove(); 129 } 130 131 if (0 === count) { 132 $elem.find('.premium-hscroll-arrow, .premium-hscroll-nav, .premium-hscroll-pagination').remove(); 133 } 134 135 if (settings.opacity) { 136 $elem.find(".premium-hscroll-temp:first").removeClass("premium-hscroll-hide"); 137 } 138 139 } 140 141 var $slides = $elem.find(".premium-hscroll-temp"); 142 143 if (settings.opacity) 144 var targetIndex = 0; 145 146 if (rtlMode) 147 targetIndex = count - 1; 148 149 150 if (-1 !== currentDevice.indexOf('tablet') || -1 !== currentDevice.indexOf('mobile')) { 151 if (snapScroll && settings.disableSnap) { 152 snapScroll = false; 153 entrance = false; 154 } 155 if (['tablet', 'tablet_extra'].includes(currentDevice)) { 156 progressOffset = 100; 157 } else if (['mobile', 'mobile_extra'].includes(currentDevice)) { 158 progressOffset = 50; 159 } 160 } else if (snapScroll) { 161 progressOffset = 30; 162 } 163 164 var $nav = $(".premium-hscroll-nav-item", $elem), 165 $arrows = $(".premium-hscroll-wrap-icon", $elem); 166 167 self.checkDisableOnOption = function () { 168 169 var disableOn = controlSettings.disable_on; 170 171 if (disableOn.includes(elementorFrontend.getCurrentDeviceMode())) { 172 173 $elem.find('.premium-hscroll-arrow, .premium-hscroll-progress, .premium-hscroll-nav, .premium-hscroll-pagination').remove(); 174 175 $elem.find(".premium-hscroll-temp").each(function (index, slide) { 176 $(slide).removeClass('premium-hscroll-temp'); 177 }); 178 179 $elem.find('.premium-hscroll-sections-wrap').removeClass('premium-hscroll-sections-wrap'); 180 181 return; 182 } 183 184 self.init(); 185 186 } 187 188 self.init = function () { 189 190 if (!count) return; 191 192 self.setLayout(); 193 194 self.setSectionsData(); 195 196 self.handleAnimations(); 197 198 self.setScene(); 199 200 if (!loop) self.checkActive(); 201 202 $nav.on("click.premiumHorizontalScroll", self.onNavDotClick); 203 204 $arrows.on("click.premiumHorizontalScroll", self.onNavArrowClick); 205 206 self.checkRemoteAnchors();
207 208 self.checkLocalAnchors(); 209 210 $(document).on('elementor/popup/show', function () { 211 self.checkLocalAnchors(); 212 }); 213 214 215 if (snapScroll) 216 document.addEventListener("wheel", self.onScroll, { passive: false }); 217 218 219 //Keyboard Scrolling. 220 document.addEventListener("keydown", self.onKeyboardPress); 221 222 if (snapScroll && settings.force_snap && document.body.scrollHeight > 3000 && $elem.offset().top > 500) { 223 224 // var windowOuterHeight = $(window).outerHeight(); 225 226 //After page reload, check if the spacing between page scroll and offset top of Hscroll is lower than 150. If so, then return. 227 // if (offset - windowOuterHeight < 150) 228 // return; 229 230 if (0 === currentActive) { 231 232 new Waypoint({ 233 element: $elem, 234 offset: 150, 235 handler: function (direction) { 236 237 if ("down" === direction) { 238 self.scrollToSlide(0, 'waypoint'); 239 } 240 241 }, 242 triggerOnce: false 243 }); 244 245 } 246 247 } 248 }; 249 250 self.checkLocalAnchors = function () { 251 252 $("a").on("click", function () { 253 254 var href = $(this).attr("href"); 255 256 if (href) { 257 258 href = href.replace('#/', ''); 259 260 self.checkAnchors(href); 261 } 262 263 }); 264 265 } 266 267 self.checkRemoteAnchors = function () { 268 269 var url = new URL(window.location.href); 270 271 if (!url) 272 return; 273 274 var horSlideID = url.searchParams.get("slide"), 275 sectionID = url.searchParams.get("section"); 276 277 278 if (horSlideID) 279 self.checkAnchors(horSlideID); 280 281 if (sectionID && $('#' + sectionID).length > 0) { 282 283 $("html, body").animate({ 284 scrollTop: $('#' + sectionID).offset().top 285 }, 1000); 286 287 } 288 289 290 }; 291 292 self.checkAnchors = function (href) { 293 294 var $slide = $elem.find(".premium-hscroll-temp[data-section='" + href + "']"); 295 296 if (!$slide.length) 297 return; 298 299 var slideIndex = $slide.index(); 300 301 self.scrollToSlide(slideIndex, "anchors"); 302 303 }; 304 305 self.onKeyboardPress = function (e) { 306 307 //If Keyboard scrolling is disabled, then use the default browser scrolling. 308 if (!settings.keyboard) { 309 // e.preventDefault(); 310 return; 311 } 312 313 self.getState(); 314 315 if ("BEFORE" === state) { 316 return; 317 } else { 318 var downKeyCodes = [40, 34], 319 upKeyCodes = [38, 33]; 320 321 if ("AFTER" === state) { 322 if (-1 !== $.inArray(e.keyCode, upKeyCodes)) { 323 var lastScrollOffset = self.getScrollOffset( 324 $slides.eq(count - 1) 325 ); 326 327 if ( 328 e.pageY - lastScrollOffset <= 300 && 329 e.pageY - lastScrollOffset > 100 330 ) { 331 332 self.preventDefault(event); 333 self.scrollToSlide(count - 1); 334 335 336 } else if (e.pageY - lastScrollOffset < 100) { 337 338 self.preventDefault(event); 339 self.scrollToSlide(count - 2); 340 } 341 342 return; 343 } 344 } else { 345 346 if (-1 !== $.inArray(e.keyCode, downKeyCodes)) { 347 if (isScrolling) { 348 self.preventDefault(event); 349 return; 350 } 351 352 self.goToNext(); 353 } 354 355 356 if (-1 !== $.inArray(e.keyCode, upKeyCodes)) { 357 if (isScrolling) { 358 self.preventDefault(event); 359 return; 360 } 361 362 self.goToPrev("keyboard"); 363 } 364 } 365 } 366 367 }; 368 369 self.getResponsiveControlValue = function (ID) { 370 371 var value = controlSettings[ID]; 372 373 if ('desktop' !== currentDevice) { 374 value = controlSettings[ID + '_' + currentDevice]; 375 } 376 377 if ('scroll_speed' === ID) { 378 379 value = !value ? 1 : value; 380 381 } else { 382 value = !value || parseFloat(('' === value.size || undefined === value) ? self.getControlDefaultVal(ID) : value.size); 383 } 384 385 return value; 386 387 }; 388 389 self.getControlDefaultVal = function (ID) { 390 391 return ['distance', 'trigger_offset'].includes(ID) ? 0 : 1; 392 }; 393 394 self.setScene = function () { 395 396 var scrollSpeed = self.getResponsiveControlValue('scroll_speed'); 397 398 // if (['desktop', 'laptop', 'widescreen'].includes(currentDevice)) { 399 scrollSpeed = scrollSpeed * 100 + "%"; 400 // } else { 401 // scrollSpeed = scrollSpeed * $elem.outerHeight(); 402 // } 403 404 //To fix trigger position when there are more than one column in the parent section. 405 $scope.closest('.elementor-column').css('align-self', 'flex-start'); 406 407 timeline = gsap.timeline({ 408 id: 'timeline' + id, 409 onUpdate: function () { 410 self.onProgress(); 411 }, 412 scrollTrigger: { 413 trigger: '#premium-hscroll-wrap-' + id, 414 pin: true, 415 start: 'top top', 416 end: scrollSpeed, 417 scrub: controlSettings.scrub ? 1.3 : 0, 418 onToggle: function () { 419 isActive = $('.one-hscroll').length > 0 ? true : !isActive; 420 }, 421 }, 422 }); 423 424 //Make sure spacer '.premium-hscroll-spacer' is set to content-box 425 setTimeout(function () { 426 self.setHorizontalSlider(); 427 }, 200); 428 429 }; 430 431 self.getDimensions = function () { 432 433 var firstWidth = $slides.eq(0).innerWidth(),
434 distance = firstWidth * (count - 1), 435 progressWidth = firstWidth * count; 436 437 var slidesInViewPort = self.getResponsiveControlValue('slides'), 438 distanceBeyond = self.getResponsiveControlValue('distance'); 439 440 distance = distance - (1 - 1 / slidesInViewPort) * $elem.outerWidth(); 441 442 distance = distanceBeyond + distance; 443 444 return { 445 distance: distance, 446 progressBar: progressWidth 447 }; 448 449 }; 450 451 self.setHorizontalSlider = function (progress) { 452 453 dimensions = self.getDimensions(); 454 455 var fromOrTo = rtlMode ? 'from' : 'to'; 456 457 if ('tablet' === currentDevice && self.checkIpad() && !rtlMode) { 458 timeline.to("#premium-hscroll-scroller-wrap-" + id, 1, { left: rtlMode ? "0px" : -dimensions.distance, ease: Power0.easeNone }, 0) 459 } else { 460 timeline[fromOrTo]("#premium-hscroll-scroller-wrap-" + id, 1, { x: -dimensions.distance, ease: Power0.easeNone }, 0); 461 } 462 463 timeline.to("#premium-hscroll-progress-line-" + id, 1, { width: dimensions.progressBar + "px", ease: Power0.easeNone }, 0); 464 465 if ($scope.hasClass('custom-scroll-bar')) { 466
467 $elem.append('<div class="horizontal-content-scroller"><span></span></div>'); 468 469 var progressWrap = $(".horizontal-content-scroller").outerWidth(), 470 progressBarSpan = $(".horizontal-content-scroller span").outerWidth(); 471 472 var progressBarTransform = progressWrap - progressBarSpan; 473 474 timeline.to('.horizontal-content-scroller span', 1, { x: progressBarTransform }, 0); 475 } 476 477 if ('undefined' !== typeof progress) { 478 scene.progress(0); 479 scene.update(true); 480 } 481 482 } 483 484 self.checkIpad = function () { 485 return /Macintosh/.test(navigator.userAgent) && 'ontouchend' in document; 486 }; 487 488 //Remove Fit to Screen to be replaced with min-height: 100vh 489 self.setLayout = function () { 490 $elem.closest("section.elementor-section-height-full").removeClass("elementor-section-height-full"); 491 }; 492 493 self.setSectionsData = function () { 494 495 var slidesInViewPort = self.getResponsiveControlValue('slides'), 496 slideWidth = 100 / slidesInViewPort; 497 498 $elem.find(".premium-hscroll-slider").css("width", count * slideWidth + "%"); 499 500 $elem.find(".premium-hscroll-temp").css("width", 100 / count + "%"); 501
502 // Will change to scroll_speed. 503 var scrollSpeed = self.getResponsiveControlValue('scroll_speed'); 504 505 var width = parseFloat( 506 $elem.find(".premium-hscroll-sections-wrap").width() / count), 507 winHeight = window.innerHeight * scrollSpeed + self.getResponsiveControlValue('trigger_offset'); 508 509 $slides.each(function (index, template) { 510 511 var sectionType = 'template' === controlSettings.section_repeater[index].template_type; 512 513 if ($(template).data("section") && !sectionType) { 514 var id = $(template).data("section"); 515 516 self.getSectionContent(id); 517 } 518 519 var position = index * width; 520 521 $(template).attr("data-position", position); 522 }); 523 524 offset = $elem.offset().top; 525 526 $slides.each(function (index, template) { 527 528 var scrollOffset = (index * (winHeight)) / (count - 1); 529 530 if (!['widescreen', 'desktop', 'laptop'].includes(currentDevice) && 0 != index) { 531 532 // check if iOS. 533 var ios = /iP(hone|ad|od)/i.test(navigator.userAgent) && !window.MSStream, 534 ios = ios || self.checkIpad(); 535 536 if (ios) { // iOS device. 537 538 var allowedBrowser = /(Chrome|CriOS|OPiOS|FxiOS)/.test(navigator.userAgent); 539 540 if (!allowedBrowser) { 541 var isFireFox = '' === navigator.vendor; 542 allowedBrowser = allowedBrowser || isFireFox; 543 } 544 545 var isSafari = /WebKit/i.test(navigator.userAgent) && !allowedBrowser; 546 547 if ('mobile' === currentDevice) { 548 549 scrollOffset = self.getTouchScrollOffset(index, isSafari ? 80 : 100, scrollSpeed, count); 550 551 } else { 552 553 scrollOffset = self.getTouchScrollOffset(index, isSafari ? 30 : 80, scrollSpeed, count); 554 555 } 556 557 } else { // Android. 558 scrollOffset = self.getTouchScrollOffset(index, 60, scrollSpeed, count); 559 } 560 } 561 562 $(template).attr("data-scroll-offset", offset + scrollOffset); 563 }); 564 }; 565 566 self.getTouchScrollOffset = function (index, addressBar, scrollSpeed, count) { 567 568 var triggerOffset = self.getResponsiveControlValue('trigger_offset'); 569 570 return (index * (($(window).innerHeight() + addressBar + triggerOffset) * scrollSpeed)) / (count - 1); 571 }; 572 573 self.onScroll = function (event) { 574 575 if ((isScrolling && null !== event) || $('.one-hscroll').length > 0) 576 self.preventDefault(event); 577 578 var delta = self.getDirection(event), 579 direction = 0 > delta ? "down" : "up"; 580 581 self.getState(); 582 583 if ("up" === direction && "AFTER" === state && document.body.scrollHeight > 3000) { 584 var lastScrollOffset = self.getScrollOffset( 585 $slides.eq(count - 1) 586 ); 587 588 if (window.pageYOffset - lastScrollOffset <= 300 && window.pageYOffset - lastScrollOffset > 100) 589 self.scrollToSlide(count - 1, 'waypoint'); 590 } 591 592 if (isActive) { 593 594 if ("down" === direction) { 595 if (!isScrolling && count - 1 !== currentActive) { 596 self.goToNext(); 597 } 598 } else if ("up" === direction) { 599 if (!isScrolling && 0 !== currentActive) self.goToPrev(); 600 } 601 602 if ( 603 (0 !== currentActive && "up" === direction) || ("down" === direction && count - 1 !== currentActive) 604 ) { 605 self.preventDefault(event); 606 } 607 } 608 }; 609 610 self.getDirection = function (e) { 611 e = window.event || e; 612 var t = Math.max( 613 -1, 614 Math.min(1, e.wheelDelta || -e.deltaY || -e.detail) 615 ); 616 return t; 617 }; 618 619 self.refresh = function () { 620 621 setTimeout(function () { 622 var sceneProgress = scene.progress(); 623 self.setHorizontalSlider(sceneProgress); 624 }, 200); 625 626 }; 627 628 self.getState = function () { 629 630 if ($('.one-hscroll').length < 1) { 631 632 switch (true) { 633 case timeline.scrollTrigger.progress < 0.01: 634 state = 'BEFORE'; 635 break; 636 637 case timeline.scrollTrigger.progress > 0.99: 638 state = 'AFTER'; 639 break; 640 641 case timeline.scrollTrigger.progress > 0.01 && timeline.scrollTrigger.progress < 0.99: 642 state = 'DURING'; 643 break; 644 } 645 646 } else { 647 state = 'DURING'; 648 } 649 650 }; 651 652 self.onProgress = function () { 653 654 var progressFillWidth = $elem.find(".premium-hscroll-progress-line").outerWidth(), 655 elemWidth = $elem.outerWidth(); 656 657 $slides.each(function (index) { 658 659 var scrollOffset = $slides.eq(index - 1).data("scroll-offset"), 660 scrollPosition = $(this).data("position"); 661 662 if (settings.opacity && targetIndex !== index) { 663 664 if (window.pageYOffset >= scrollOffset + elemWidth / 8) { 665 $(this).removeClass("premium-hscroll-hide"); 666 } else { 667 $(this).addClass("premium-hscroll-hide"); 668 } 669 670 } 671 672 if (progressFillWidth >= scrollPosition - progressOffset) { 673 674 if (entrance && !isScrolling) 675 self.triggerAnimations(); 676 677 if (-1 === currentActiveArr.indexOf(index)) { 678 679 currentActiveArr.push(index); 680 681 currentActive = index; 682 self.onSlideChange(); 683 } 684 685 } else { 686 687 if (-1 !== currentActiveArr.indexOf(index)) { 688 currentActiveArr.pop();
689 690 currentActive = currentActiveArr[currentActiveArr.length - 1]; 691 self.onSlideChange(); 692 } 693 694 } 695 }); 696 }; 697 698 self.onSlideChange = function () { 699 700 prevActive = currentActive; 701 702 self.addBackgroundLayer(); 703 704 if (settings.pagination && !snapScroll) { 705 706 var text = currentActive + 1 > 9 ? "" : "0"; 707 $elem 708 .find(".premium-hscroll-current-slide") 709 .text(text + (currentActive + 1)); 710 } 711 712 $nav.removeClass("active"); 713 714 $elem 715 .find(".premium-hscroll-nav-item") 716 .eq(currentActive) 717 .addClass("active"); 718 719 self.checkActive(); 720 721 if (entrance && !isScrolling) 722 self.restartAnimations(currentActive); 723 }; 724 725 self.addBackgroundLayer = function () { 726 727 if ($elem.find(".premium-hscroll-bg-layer").eq(currentActive).length > 0) { 728 729 $elem.find(".premium-hscroll-layer-active").removeClass("premium-hscroll-layer-active"); 730 731 $elem.find(".premium-hscroll-bg-layer").eq(currentActive).addClass("premium-hscroll-layer-active"); 732 733 } 734 735 736 737 }; 738 739 self.getSectionContent = function (sectionID) { 740 if (!$("#" + sectionID).length) 741 return; 742 743 var htmlContent = $("#" + sectionID); 744 745 if (!editMode) { 746 $("#premium-hscroll-scroller-wrap-" + id) 747 .find('div[data-section="' + sectionID + '"]') 748 .append(htmlContent); 749 } else { 750 $slides.find(".elementor-element-overlay") 751 .remove(); 752 $("#premium-hscroll-scroller-wrap-" + id) 753 .find('div[data-section="' + sectionID + '"]') 754 .append(htmlContent.clone(true)); 755 } 756 }; 757 758 self.checkActive = function () { 759 if (!$arrows.length) return; 760 761 if (loop) { 762 if (-1 === currentActive) { 763 currentActive = count - 1; 764 } else if (count === currentActive) { 765 currentActive = 0; 766 } 767 } else { 768 if (0 === currentActive) { 769 $elem 770 .find(".premium-hscroll-arrow-left") 771 .addClass("premium-hscroll-arrow-hidden"); 772 } else { 773 $elem 774 .find(".premium-hscroll-arrow-left") 775 .removeClass("premium-hscroll-arrow-hidden"); 776 } 777 778 if (count - 1 === currentActive) { 779 $elem 780 .find(".premium-hscroll-arrow-right") 781 .addClass("premium-hscroll-arrow-hidden"); 782 } else { 783 $elem 784 .find(".premium-hscroll-arrow-right") 785 .removeClass("premium-hscroll-arrow-hidden"); 786 } 787 } 788 789 }; 790 791 self.onNavDotClick = function () { 792 if (isScrolling) return; 793 794 var $item = $(this), 795 index = $item.index(); 796 797 if (index === prevActive && isActive) return; 798 799 currentActive = index; 800 801 self.scrollToSlide(index); 802 }; 803 804 self.onNavArrowClick = function (e) { 805 if (isScrolling) return; 806 807 if ($(e.target).closest(".premium-hscroll-arrow-left").length) { 808 self.goToPrev(); 809 } else if ($(e.target).closest(".premium-hscroll-arrow-right").length) { 810 self.goToNext(); 811 } 812 813 }; 814 815 self.goToNext = function () { 816 if (isScrolling) return; 817 818 currentActive++; 819 820 if (loop) { 821 if (-1 === currentActive) { 822 currentActive = count - 1; 823 } else if (count === currentActive) { 824 currentActive = 0; 825 } 826 } 827 828 self.scrollToSlide(currentActive); 829 }; 830 831 self.goToPrev = function (trigger) { 832 833 if (isScrolling || ("keyboard" === trigger && currentActive === 0)) 834 return; 835 836 currentActive--; 837 838 if (loop) { 839 if (-1 === currentActive) { 840 currentActive = count - 1; 841 } else if (count === currentActive) { 842 currentActive = 0; 843 } 844 } 845 846 self.scrollToSlide(currentActive); 847 }; 848 849 self.scrollToSlide = function (slideIndex, scrollSrc) { 850 851 var targetOffset = self.getScrollOffset($slides.eq(slideIndex)); 852 853 if (!scrollSrc) { 854 if (isScrolling) return; 855 } else if ('waypoint' === scrollSrc) { 856 targetOffset = targetOffset + (0 == slideIndex ? 2 : -1); 857 } 858 859 if (0 > currentActive || count - 1 < currentActive) return; 860 861 isScrolling = true; 862 863 prevActive = slideIndex; 864 865 var spacerHeight = $("#premium-hscroll-spacer-" + id).outerHeight(); 866 867 if (!snapScroll) { 868 869 gsap.to(window, 1.5, { 870 scrollTo: targetOffset - spacerHeight, 871 ease: Power3.easeOut, 872 onComplete: self.afterSlideChange 873 }); 874 875 } else { 876 877 $("html, body").stop().clearQueue().animate({ 878 scrollTop: targetOffset 879 }, 1000, function () { 880 var currentX = gsap.getProperty("#premium-hscroll-scroller-wrap-" + id, 'x'), 881 leftOffset = $slides.eq(slideIndex)[0].getBoundingClientRect().x; 882 883 setTimeout(function () { 884 gsap.set("#premium-hscroll-scroller-wrap-" + id, { 885 x: currentX - leftOffset 886 }); 887 }, 30); 888 889 }); 890 891 } 892 893 if (settings.pagination && snapScroll) 894 $elem.find(".premium-hscroll-current-slide").removeClass("zoomIn animated"); 895 896 if (settings.pagination && snapScroll) { 897 setTimeout(function () { 898 899 if ( 900 currentActive + 1 != 901 $elem.find(".premium-hscroll-current-slide") 902 .text() 903 ) { 904 //Lead zero 905 var text = currentActive + 1 > 9 ? "" : "0"; 906 $elem 907 .find(".premium-hscroll-current-slide") 908 .text(text + (currentActive + 1)) 909 .addClass("zoomIn animated"); 910 } 911 }, 1000); 912 } 913 914 if (entrance && !entranceOnce) { 915 916 setTimeout(function () { 917 self.setAnimations(); 918 }, 1000); 919 } 920 921 if (snapScroll) { 922 setTimeout(function () { 923 isScrolling = false; 924 }, 1200); 925 } 926 }; 927 928 self.afterSlideChange = function () { 929 isScrolling = false; 930 }; 931 932 self.handleAnimations = function () { 933 934 if (entranceOnce) 935 return; 936 937 if (entrance) { 938 939 self.hideAnimations(); 940 941 new Waypoint({ 942 element: $elem, 943 offset: '100%', 944 handler: function () { 945 self.setAnimations(); 946 } 947 }); 948 949 } else { 950 self.unsetAnimations(); 951 } 952 }; 953 954 self.hideAnimations = function () { 955 956 $slides.find(".elementor-invisible").addClass("premium-hscroll-elem-hidden"); 957 958 }; 959 960 self.unsetAnimations = function () { 961 962 $slides.not(":eq(0)").find(".elementor-invisible").each(function (index, elem) { 963 964 $(elem).removeClass("elementor-invisible"); 965 966 var dataSettings = $(elem).data("settings"); 967 968 if (dataSettings) { 969 970 delete dataSettings._animation; 971 972 delete dataSettings.animation; 973 974 $(elem).attr("data-settings", JSON.stringify(dataSettings)); 975 976 } 977 978 }); 979 980 }; 981 982 self.setAnimations = function () { 983 984 self.restartAnimations(); 985 986 self.triggerAnimations(); 987 }; 988 989 self.restartAnimations = function (slideIndex) { 990 var $unactiveSlides = $slides.filter(function (index) { 991 return index !== slideIndex; 992 }); 993 994 $unactiveSlides.find(".animated") 995 .each(function (index, elem) { 996 var settings = $(elem) 997 .data("settings"); 998 999 if (undefined === settings) return; 1000 1001 var animation = settings._animation || settings.animation; 1002 1003 $(elem) 1004 .removeClass("animated " + animation) 1005 .addClass("elementor-invisible"); 1006 }); 1007 }; 1008 1009 self.triggerAnimations = function () { 1010 1011 $slides.eq(currentActive).find(".elementor-invisible, .premium-hscroll-elem-hidden").each(function (index, elem) { 1012 var settings = $(elem) 1013 .data("settings"); 1014 1015 if (undefined === settings) return; 1016
1017 if (!settings._animation && !settings.animation) return; 1018 1019 var delay = settings._animation_delay ? settings._animation_delay : 0, 1020 animation = settings._animation || settings.animation; 1021 1022 setTimeout(function () { 1023 $(elem) 1024 .removeClass("elementor-invisible premium-hscroll-elem-hidden") 1025 .addClass(animation + " animated"); 1026 }, delay); 1027 }); 1028 }; 1029 1030 self.getScrollOffset = function (item) { 1031 1032 if (!$(item).length) 1033 return; 1034 1035 var slideOffset = $(item).data("scroll-offset"); 1036 1037 if ($("#upper-element").length > 0) { 1038 slideOffset = slideOffset + $("#upper-element").closest(".premium-notbar-outer-container").outerHeight(); 1039 $(item).attr("data-scroll-offset", slideOffset); 1040 } 1041 1042 return slideOffset; 1043 }; 1044 1045 self.preventDefault = function (event) { 1046 if (event.preventDefault) { 1047 event.preventDefault(); 1048 } else { 1049 event.returnValue = false; 1050 } 1051 }; 1052 }; 1053 1054 elementorFrontend.elementsHandler.attachHandler('premium-hscroll', PremiumHorizontalScrollHandler); 1055 1056 }); 1057 1058})(jQuery);
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.