gsap.registerPlugin(SplitText); gsap.config({ nullTargetWarn: false }); document.addEventListener( "click", function (e) { var a = e.target.closest && e.target.closest("a"); if (!a) return; var href = a.getAttribute("href") || ""; if ( a.hostname === window.location.host && href.indexOf("#") === -1 && a.target !== "_blank" ) { sessionStorage.setItem("ww-internal-nav", "true"); } }, true ); $(window).on("beforeunload", function () { $(window).scrollTop(0); }); let mm = gsap.matchMedia(); //LENIS let loadSplit = new SplitText(".preloader-text, [split]", { type: "lines, words,chars", linesClass: "line", wordsClass: "word", charsClass: "char", }); let cursorSplit = new SplitText(".cursor-text", { type: "chars", charsClass: "char", }); mm.add("(min-width: 992px)", () => { let footerSplit = new SplitText(".footer-heading", { type: "chars", charsClass: "char", }); return () => { footerSplit.revert(); // Clean up on media query change }; }); let charSplit = new SplitText("[heading-split]", { type: "words", wordsClass: "word", }); $("[heading-split]").each(function (index) { let headingSpan = $(this).find(".span-wrapper"); let tl = gsap.timeline({ scrollTrigger: { trigger: $(this), start: "top 100%", toggleActions: "play none none none", }, }); tl.from($(this).find(".word"), { // filter: "blur(5px)", opacity: 0, duration: 0.2, stagger: { each: 0.02 }, ease: "power1.out", }); if (headingSpan.length > 0) { tl.from( $(this).find(".span-wrapper"), { filter: "blur(6px)", duration: 0.8, ease: "power1.out", }, "<" ); } }); const lenis = new Lenis(); lenis.on("scroll", (e) => {}); lenis.on("scroll", ScrollTrigger.update); gsap.ticker.add((time) => { lenis.raf(time * 1000); }); gsap.ticker.lagSmoothing(0); $("video").each(function () { this.muted = true; this.load(); this.play().catch(() => {}); }); function homepage() { gsap.set(".transition_wrap", { display: "none" }); //CURSOR let cursor = Observer.create({ onMove: (self) => { let mouseX = self.x; let mouseY = self.y; gsap.to(".cursor-el", { duration: 0.3, x: mouseX, y: mouseY, ease: "power1.out", }); gsap.to(".team-img_el", { duration: 0.6, // x: mouseX, y: mouseY, ease: "power1.out", }); }, }); // function animatePreloader() { // function setRandomNumber(selector, min, max) { // const randomNumber = Math.floor(Math.random() * (max - min + 1)) + min; // document.querySelector(selector).innerText = randomNumber; // } var __wwSkipPreloader = sessionStorage.getItem("ww-internal-nav") === "true" && (performance.getEntriesByType("navigation")[0] || {}).type !== "reload"; sessionStorage.removeItem("ww-internal-nav"); // setRandomNumber(".loader-text.is-1", 0, 0); // setRandomNumber(".loader-text.is-2", 10, 30); // setRandomNumber(".loader-text.is-3", 31, 52); // setRandomNumber(".loader-text.is-4", 53, 87); // setRandomNumber(".loader-text.is-5", 88, 99); // setRandomNumber(".loader-text.is-6", 100, 100); lenis.stop(); let pl = gsap.timeline({ onComplete: () => { heroScroll(); // gsap.set(".nav-logo_wrap", { // opacity: 1, // }); }, }); pl.timeScale(1); pl.set(".page-wrap", { opacity: 1, }); // mm.add("(max-width: 991px)", () => { // pl.set( // ".home-nav", // { // height: "100vh", // }, // 0 // ); // pl.set( // ".nav-logo", // { // scale: 2, // }, // 0 // ); pl.set( ".menu-icon_wrap", { display: "none", }, 0 ); // pl.set( // ".nav-logo_wrap", // { // width: "100%", // justifyContent: "center", // }, // 0 // ); // }); pl.to( ".loading-text, .loader-wrap", { opacity: 1, }, "<0.2" ); pl.to(".cursor-text_holder", { opacity: 1, }); gsap.fromTo( ".preloader_logo", { clipPath: "polygon(0% 0%, 0% 0%, 0% 100%, 0% 100%)", }, { clipPath: "polygon(100% 0%, 0% 0%, 0% 100%, 100% 100%)", duration: 1.5, ease: "expo.out", // onComplete: () => { // clipSwiper(); // }, }, "<" ); // pl.to( // ".loader-holder", // { // yPercent: -100, // duration: 0.4, // ease: "expo.inOut", // }, // "<" // ); // pl.to(".loader-holder", { // yPercent: -200, // duration: 0.4, // ease: "expo.inOut", // }); // pl.to(".loader-holder", { // yPercent: -300, // duration: 0.4, // ease: "expo.inOut", // }); // pl.to(".loader-holder", { // yPercent: -400, // duration: 0.4, // ease: "expo.inOut", // }); // pl.to(".loader-holder", { // yPercent: -500, // duration: 0.4, // ease: "expo.inOut", // }); // pl.fromTo( // ".preloader_logo", // { // clipPath: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)", // }, // { // clipPath: "polygon(0% 50%, 100% 50%, 100% 50%, 0% 50%)", // duration: 2, // ease: "expo.out", // // clearProps: "all", // }, // "<+1" // ); pl.fromTo( ".loading-text, .loader-wrap, .preloader_logo, .preloader_logo2", { opacity: 1, // clipPath: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)", }, { opacity: 0, // clipPath: "polygon(0% 50%, 100% 50%, 100% 50%, 0% 50%)", duration: 0.8, ease: "expo.out", }, "<+1" ); // pl.fromTo( // ".preloader_logo", // { // clipPath: "polygon(100% 0%, 0% 0%, 0% 100%, 100% 100%)", // }, // { // clipPath: "polygon(0% 0%, 0% 0%, 0% 100%, 0% 100%)", // duration: 0.8, // ease: "expo.out", // }, // "<+0.1" // ); // $(".preloader-gradient").each(function () { // let paths = $(this).find("path"); pl.to( gsap.utils .toArray(".preloader-gradient path") .filter( (p) => getComputedStyle(p.closest(".preloader-gradient")).display !== "none" ), { opacity: 0, duration: 0.6, ease: "power1.out", stagger: { amount: 1, }, onComplete: () => { lenis.start(); }, }, "<" ); // }); pl.to( ".nav-logo", { opacity: 1, }, "<" ); pl.fromTo( ".tagline-1.hero, .hero_subtext.favorit", { opacity: 0, }, { opacity: 1, }, "<+0.6" ); // mm.add("(min-width: 992px)", () => { pl.fromTo( ".home-nav, .menu-icon_holder", { opacity: 0, }, { opacity: 1, duration: 0.8, ease: "power3.inOut", // clearProps: "all", }, "<" ); // pl.fromTo( // ".nav-logo", // { // scale: 5, // }, // { // scale: 1, // duration: 0.8, // ease: "power3.inOut", // }, // "<" // ); // }); pl.from( "[nav-sides]", { opacity: 0, onComplete: () => { gsap.set(".preloader-mid_wrap", { opacity: 1, }); }, }, "<" ); // mm.add("(min-width: 992px)", () => { pl.fromTo( $(".preloader-text").find(".word"), { opacity: 0, yPercent: 100, }, { opacity: 1, yPercent: 0, duration: 1.5, stagger: { each: 0.05 }, ease: "expo.out", }, "<" ); // }); // mm.add("(max-width: 991px)", () => { // pl.fromTo( // $(".preloader-text").find(".word"), // { // opacity: 0, // yPercent: 100, // }, // { // opacity: 1, // yPercent: 0, // duration: 2, // stagger: { each: 0.1 }, // ease: "expo.out", // onComplete: () => { // lenis.start(); // }, // }, // "<-2" // ); // }); // pl.to( // ".slider_nav_wrap, .slider_thumb", // { // opacity: 1, // duration: 1, // }, // "<+0.3" // ); // pl.to( // ".slider_btn", // { // pointerEvents: "auto", // }, // "<" // ); // pl.set(".slider_btn", { cursor: "pointer" }); pl.to( ".hero-center_caption", { opacity: 1, duration: 0.8, ease: "power3.inOut", }, "<+0.9" ); // mm.add("(max-width: 991px)", () => { pl.to(".m-hero_text, .m-btn_play", { opacity: 1, duration: 0.8, ease: "power3.inOut", stagger: { each: 0.3 }, }); pl.set( ".home-nav", { height: "auto", }, "<" ); // pl.set( // ".nav-logo", // { // scale: 1, // }, // "<" // ); // pl.set( // ".menu-icon_wrap", // { // display: "flex", // }, // "<" // ); // pl.set( // ".nav-logo_wrap", // { // width: "30%", // justifyContent: "flex-start", // }, // "<" // ); // pl.fromTo( // ".nav-logo_wrap", // { // opacity: 0, // }, // { // opacity: 1, // immediateRender: false, // duration: 0.8, // ease: "power3.inOut", // }, // "<" // ); // }); pl.to( ".cursor, .hero-btn-mid", { opacity: 1, duration: 0.5, }, "<" ); if (__wwSkipPreloader) { pl.progress(1); lenis.start(); gsap.fromTo( ".page-wrap", { opacity: 0 }, { opacity: 1, duration: 0.6, ease: "power2.out" } ); } let windowWidth = $(window).innerWidth(); window.addEventListener("resize", function () { if (windowWidth !== $(window).innerWidth()) { windowWidth = $(window).innerWidth(); // // heroScroll(); // lenis.resize(); // ScrollTrigger.refresh(); pl.progress(1); } }); //HOMEPAGE EXIT PAGE TRANSITION // Link click $("a:not(.excluded-class)").on("click", function (e) { let currentUrl = $(this).attr("href"); if ( $(this).prop("hostname") === window.location.host && !currentUrl.includes("#") && $(this).attr("target") !== "_blank" ) { e.preventDefault(); lenis.stop(); let ptl = gsap.timeline({ onComplete: () => (window.location.href = currentUrl), }); ptl.set(".home-transition_wrap", { display: "flex" }); $(".homepage-gradient_holder").each(function () { let paths = $(this).find("path"); ptl.fromTo( paths, { opacity: 0, }, { opacity: 1, duration: 1, stagger: { amount: 1, }, } ); }); } }); // On Back Button Tap window.onpageshow = function (event) { if (event.persisted) window.location.reload(); }; //PRELOADER END function heroInset() { let hInset = gsap.matchMedia(); hInset.add("(min-width: 992px)", () => { $(".page-wrap").each(function () { let preloaderMain = $(this); let preloaderHero = $(this).find(".preloader-wrap"); let preloaderSpacer1 = $(this).find(".section-ii"); let preloaderHeroClip = gsap.timeline({ scrollTrigger: { trigger: preloaderSpacer1, start: "top bottom", end: "bottom top", scrub: true, }, }); preloaderHeroClip.fromTo( preloaderHero, { clipPath: "inset(0 0 0 0 round 0)", }, { clipPath: "inset(0 2% 0 2% round 0.25rem)", } ); }); }); } heroInset(); // Call the function to apply the functionality only on HOMEPAGE // handleLinkClickAndBackButton(); //HERO SCROLL function heroScroll() { //Desktop hero vid // mm.add("(min-width: 992px)", () => { // // let heroIntroScroll1 = gsap.timeline({ // // scrollTrigger: { // // trigger: ".preloader-trigger_1", // // start: "top bottom", // // end: "top top", // // scrub: true, // // }, // // }); // // heroIntroScroll1.to($(".preloader-text").find(".word"), { // // yPercent: -200, // // opacity: 0, // // // filter: "blur(6px)", // // ease: "linear", // // stagger: { // // each: 0.03, // // }, // // }); // heroIntroScroll1.to( // ".hero-center_caption", // { // opacity: 0, // }, // "<" // ); // heroIntroScroll1.set(".preloader-svg_holder", { // pointerEvents: "none", // }); // // let heroIntroScroll2 = gsap.timeline({ // // scrollTrigger: { // // trigger: ".preloader-trigger_1", // // start: "top bottom", // // end: "top center", // // endTrigger: ".preloader-trigger_2", // // scrub: true, // // }, // // }); // // heroIntroScroll2.to(".video-item", { // // width: "62em", // // height: "34em", // // ease: "linear", // // }); // // heroIntroScroll2.to( // // ".preloader-vid_tag", // // { // // opacity: 1, // // ease: "linear", // // }, // // "<25%" // // ); // // heroIntroScroll2.set(".video-item", { // // pointerEvents: "auto", // // }); // }); } // mm.add("(min-width: 992px)", () => { // let videoEL = $(".video-element"); // let videoPopup = gsap.timeline({ // paused: true, // onStart: () => { // lenis.stop(); // }, // onComplete: () => { // videoEL.get(0).play(); // }, // onReverseComplete: () => { // lenis.start(); // }, // }); // videoPopup.set(".video-popup", { // display: "flex", // }); // videoPopup.to(".video-bg", { // opacity: 1, // duration: 0.6, // }); // videoPopup.set(".video-bg", { // pointerEvents: "auto", // }); // videoPopup.fromTo( // ".video-popup_el", // { // opacity: 0, // width: "62em", // }, // { opacity: 1, width: "80em" }, // ); // $(".video-item, .m-btn_play").on("click", function () { // videoPopup.restart(); // }); // $(".video-bg").on("click", function () { // videoEL.get(0).pause(); // videoPopup.reverse(); // }); // }); // mm.add("(max-width: 991px)", () => { // let videoEL = $(".video-element"); // let videoPopup = gsap.timeline({ // paused: true, // onStart: () => { // lenis.stop(); // }, // onComplete: () => { // videoEL.get(0).play(); // }, // onReverseComplete: () => { // lenis.start(); // }, // }); // videoPopup.set(".video-popup", { // opacity: 0, // display: "flex", // }); // videoPopup.fromTo( // ".video-popup", // { // opacity: 0, // }, // { // opacity: 1, // duration: 1, // }, // ); // videoPopup.to(".preloader-vid_tag", { // opacity: 1, // ease: "linear", // }); // videoPopup.to(".video-bg", { // opacity: 1, // duration: 0.2, // }); // videoPopup.set(".video-bg", { // pointerEvents: "auto", // }); // // videoPopup.fromTo( // // ".video-popup_el", // // { // // scale: 1, // // }, // // { // // scale: 1.5, // // }, // // "<", // // ); // $(".video-item, .m-btn_play").on("click", function () { // videoPopup.restart(); // }); // $(".video-bg").on("click", function () { // videoEL.get(0).pause(); // videoPopup.reverse(); // }); // }); $(".wellness-slider_holder .swiper-slide").each(function (index) { let triggerValue = $(this).attr("modal-trigger"); let relatedTrigger = $(this).find(".slide-content"); let modalWrapper = $( '.wellness-modal_item[modal-trigger="' + triggerValue + '"]' ); let modalContent = $( '.wellness-modal_item[modal-trigger="' + triggerValue + '"] .wellness-modal_right' ); let relatedBg = modalWrapper.find(".modal-bg"); let modalDuration = 0.6; let modalEase = "power2.out"; let modalTl = gsap.timeline({ paused: true, onStart: function () { lenis.stop(); }, onComplete: function () { gsap.set(relatedBg, { pointerEvents: "auto", }); }, onReverseComplete: function () { lenis.start(); gsap.set(relatedBg, { pointerEvents: "none", }); }, }); modalTl.set(".wellness-modal_wrapper", { display: "block", }); modalTl.set(modalWrapper, { display: "flex", }); // mm.add("(max-width: 991px)", () => { // modalTl.set(modalWrapper, { // position: "relative", // }); // }); modalTl.fromTo( modalContent, { xPercent: 110, }, { xPercent: 0, duration: 1, ease: "power2.out", onStart: function () { $(".wellness-modal_wrapper").scrollTop(0); }, } ); modalTl.to( ".wellness-modal_wrapper", { backdropFilter: "blur(10px)", duration: modalDuration, ease: modalEase, }, "<" ); relatedTrigger.on("click", function () { modalTl.restart(); }); relatedBg.on("click", function () { modalTl.reverse(); }); $(".wellness-modal_close").on("click", function () { modalTl.reverse(); }); }); $(".span-wrapper").each(function (index) { let relatedEl = $(".span-element").eq(index); relatedEl.appendTo($(this)); }); //SLIDER TESTIMONIAL function animateImage() { gsap.to(".testimonial-img", { scale: 1.01, duration: 3, }); } let swiper = new Swiper(".swiper.testimonial", { autoplay: { delay: 5000, // Adjusted delay to match autoplay disableOnInteraction: false, }, on: { slideChange: function () { animateImage(); }, }, autoHeight: false, slidesPerView: 1, speed: 500, effect: "fade", fadeEffect: { crossFade: true }, loop: true, slideActiveClass: "is-active", navigation: { nextEl: ".swiper-next", prevEl: ".swiper-prev", }, }); function startProgressBar() { let progressBar = document.querySelectorAll(".slider_dot_line"); let delay = swiper.params.autoplay.delay; progressBar.forEach((bar, index) => { let isCurrentSlide = index === swiper.realIndex; bar.style.transition = isCurrentSlide ? `transform ${delay}ms linear` : "none"; bar.style.transform = isCurrentSlide ? "scaleX(1)" : "scaleX(0)"; }); } swiper.on("slideChange", startProgressBar); function handleVisibilityChange() { if (!document.hidden) { swiper.autoplay.start(); startProgressBar(); } else { swiper.autoplay.stop(); } } startProgressBar(); animateImage(); document.addEventListener("visibilitychange", handleVisibilityChange); //SLIDER GRADIENT // function gradientAnimation() { // let items = document.querySelectorAll(".slider-gradient"); // items.forEach((item) => { // let animateItem = () => { // let scale = gsap.utils.random(1, 1.5); // let nextScale = gsap.utils.random(1, 1.5); // gsap.to(item, { // duration: 4, // scale: nextScale, // ease: "linear", // onStart: () => { // // Force GPU acceleration to potentially reduce flickering // item.style.willChange = "transform"; // }, // modifiers: { // scale: () => { // scale = nextScale; // nextScale = gsap.utils.random(1, 1.5); // while (nextScale === scale) { // nextScale = gsap.utils.random(1, 1.5); // } // return nextScale; // }, // }, // onComplete: animateItem, // Chain the next animation // }); // }; // animateItem(); // }); // } // gradientAnimation(); //TEAM DROPDOWN gsap.set(".team-img_holder", { opacity: 0, }); gsap.set(".team-item_intro", { opacity: 0, height: "0px", }); let lastHovered; $(".team-item").each(function () { let teamImg = $(this).find(".team-img_el"); let teamName = $(this).find(".team-item_left"); let teamNameFlex = $(this).find(".profile-holder"); let teamInfo = $(this).find(".team-item_intro"); let teamImgHolder = $(this).find(".team-img_holder"); let teamLayout = $(this).find(".team-layout"); let teamPlus = $(this).find(".svg-plus"); $(".team-wrapper").on("mouseenter", function () { gsap.set(".team-img_holder", { opacity: 1, overwrite: true, }); }); $(".team-wrapper").on("mouseleave", function () { gsap.to(teamImg, { clipPath: "polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%)", rotation: -5, duration: 0.6, ease: "circ.inOut", }); gsap.set(".team-img_holder", { opacity: 0, delay: 0.6, }); }); let teamImgHover = gsap.timeline({ paused: true }); teamImgHover.set(teamImgHolder, { opacity: 1, }); // teamImgHover.set(teamImgHolder, { // clipPath: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)", // }); teamImgHover.set($(this), { zIndex: 10, }); teamImgHover.fromTo( teamImg, { rotation: -5, clipPath: "polygon(50% 50%, 50% 50%, 50% 50%, 50% 50%)", }, { rotation: 0, clipPath: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)", duration: 0.6, ease: "circ.inOut", } ); $(this).on("mouseenter", function () { gsap.set(".team-item", { zIndex: 1 }); if (lastHovered) { gsap.set(lastHovered, { zIndex: 3 }); } gsap.set($(this), { zIndex: 10 }); teamImgHover.restart(); }); $(this).on("mouseleave", function () { lastHovered = $(this); }); let showTeamInfo = gsap.timeline({ paused: true }); showTeamInfo.to(teamInfo, { height: "auto", duration: 0.6, ease: "power3.out", }); showTeamInfo.to( teamNameFlex, { color: "#D95D8D", duration: 0.6, marginBottom: "auto", ease: "power3.out", }, "<" ); showTeamInfo.to( teamPlus, { opacity: 0, duration: 0.3, ease: "linear", }, "<" ); showTeamInfo.to( teamInfo, { opacity: 1, duration: 0.3, ease: "linear", }, "<50%" ); $(teamLayout).on("click", function () { if (showTeamInfo.reversed()) { showTeamInfo.timeScale(1).play(); } else { showTeamInfo.timeScale(1).reverse(); } }); $(this).on("mouseleave", function () { showTeamInfo.timeScale(1.5).reverse(); }); }); // //MOBILE TEAM OPEN // // Function to open the mobile slider // function mobileTeamOpen() { // let mto = gsap.timeline({ // paused: true, // }); // mto.to(".mobile-team_dropdown-wrap", { // display: "flex", // }); // mto.to(".mobile-team_dropdown-wrap", { // opacity: 1, // duration: 0.2, // }); // mto.fromTo( // ".mobile-team_dropdown", // { // opacity: 0, // yPercent: -20, // }, // { // opacity: 1, // yPercent: 0, // duration: 0.2, // ease: "power3in.Out", // onComplete: function () { // lenis.stop(); // }, // }, // ); // // GSAP matchMedia for screen size // mm.add("(max-width: 991px)", () => { // // Play the timeline when .dropdown-toggle is clicked // document // .querySelector(".dropdown-reset") // .addEventListener("click", function () { // mto.play(); // }); // // Reverse the timeline when .dropdown-text or .mobile-wellness_dropdown-wrap is clicked // document // .querySelector(".dropdown-text") // .addEventListener("click", function () { // mto.reverse(); // lenis.start(); // }); // document // .querySelector(".mobile-team_dropdown-wrap") // .addEventListener("click", function () { // mto.reverse(); // lenis.start(); // }); // }); // } // mobileTeamOpen(); // var previousIndex = null; // Add the is-active class to the first items initially // $(".wellness-dropdown_holder .wellness-text:first-child").addClass( // "is-active" // ); // $(".wellness-swiper_wrap:first-child").addClass("is-active"); $(".wellness-swiper_wrap").each(function (index) { let swiperEl = $(this).find(".swiper.minds"); let wellnessSwiper = new Swiper(swiperEl[0], { grabCursor: true, slidesPerView: "auto", speed: 1000, // freeMode: true, spaceBetween: 20, momentum: true, sticky: true, // centerInsufficientSlides: true, // simulateTouch: true, // freeModeMomentumRatio: 0.1, // mousewheel: true, keyboard: true, // parallax: true, }); }); //HOME HERO SLIDER OPEN let itemCount = $(".slider_cms_item").length; let $navList = $(".slider_nav_list").empty(); for (let i = 0; i < itemCount; i++) { $navList.append(`
`); } // function clipSwiper() { // mm.add("(min-width: 992px)", () => { // $(".preloader-wrap").each(function () { // let childArrow = $(this).find(".slider_btn"); // let childItems = $(this).find(".slider_cms_item").hide(); // let childDots = $(this).find(".slider_nav_item"); // let totalSlides = childItems.length; // let activeIndex = 0; // childItems.first().css("display", "flex"); // // Set initial width for all nav items // // mm.add("(min-width: 992px)", () => { // childDots.css("width", "0.25rem"); // // Set the first dot as active and change its width // childDots.eq(0).addClass("active").css("width", "100%"); // gsap.set(childDots.eq(0).find(".slider_nav_line"), { x: "0%" }); // // }); // // mm.add("(max-width: 991px)", () => { // // childDots.css("width", "0rem"); // // // Set the first dot as active and change its width // // childDots.eq(0).addClass("active").css("width", "100%"); // // gsap.set(childDots.eq(0).find(".slider_nav_line"), { x: "0%" }); // // }); // let tl2 = gsap.timeline({ repeat: -1 }); // childDots.each(function (index) { // tl2.addLabel(`step${index}`); // tl2.to($(this).find(".slider_nav_line"), { // scaleX: "1.0", // ease: "none", // duration: 9, // onComplete: () => { // goNext(index + 1); // }, // }); // }); // function moveSlide(nextIndex, forwards) { // // Remove active class from current dot and reset width // childDots // .eq(activeIndex) // .removeClass("active") // .css("width", "0.5rem"); // // Add active class to next dot and set width // childDots.eq(nextIndex).addClass("active").css("width", "80%"); // let tl3 = gsap.timeline(); // tl3.set(childDots.eq(nextIndex).find(".slider_nav_line"), { // x: "0%", // }); // tl3.fromTo( // childDots.eq(activeIndex).find(".slider_nav_line"), // { x: "0%" }, // { x: "100%" } // ); // tl2.seek(`step${nextIndex}`); // let titleFrom = -100; // let titleDelay = "<"; // if (forwards) { // titleFrom = 100; // titleDelay = "<50%"; // } // childItems.hide(); // let prevItem = childItems.eq(activeIndex).css("display", "flex"); // let nextItem = childItems.eq(nextIndex).css("display", "flex"); // let tl = gsap.timeline({ // defaults: { duration: 1, ease: "power2.inOut" }, // }); // if (forwards) { // tl.fromTo(nextItem, { opacity: 0 }, { opacity: 1, duration: 0.2 }); // tl.to(prevItem, { opacity: 0, duration: 0.2 }, "<"); // } else { // tl.fromTo(nextItem, { opacity: 0 }, { opacity: 1, duration: 0.2 }); // tl.to(prevItem, { opacity: 0, duration: 0.2 }, "<"); // } // tl.fromTo( // nextItem.find(".training-option_caption .char"), // { yPercent: titleFrom }, // { yPercent: 0, duration: 0.5, stagger: { amount: 0.05 } }, // titleDelay // ); // tl.fromTo( // nextItem.find(".slider_eyebrow, .slider_copy_box"), // { opacity: 0 }, // { opacity: 1 }, // "<+0.2" // ); // activeIndex = nextIndex; // } // function goNext(num) { // let nextIndex = num; // if (nextIndex > totalSlides - 1) nextIndex = 0; // moveSlide(nextIndex, true); // } // childArrow.filter(".is-next").on("click", function () { // goNext(activeIndex + 1); // }); // childArrow.filter(".is-prev").on("click", function () { // let nextIndex = activeIndex - 1; // if (nextIndex < 0) nextIndex = totalSlides - 1; // moveSlide(nextIndex, false); // }); // childDots.on("click", function () { // let dotIndex = $(this).index(); // if (activeIndex > dotIndex) { // moveSlide(dotIndex, false); // } else if (activeIndex < dotIndex) { // moveSlide(dotIndex, true); // } // }); // }); // }); // //MOBILE // mm.add("(max-width: 991px)", () => { // $(".preloader-wrap").each(function () { // let childArrow = $(this).find(".slider_btn"); // let childItems = $(this).find(".slider_cms_item").hide(); // let childDots = $(this).find(".slider_nav_item"); // let totalSlides = childItems.length; // let activeIndex = 0; // childItems.first().css("display", "flex"); // // Set initial width for all nav items // // mm.add("(min-width: 992px)", () => { // childDots.css("width", "0rem"); // // Set the first dot as active and change its width // childDots.eq(0).addClass("active").css("width", "100%"); // gsap.set(childDots.eq(0).find(".slider_nav_line"), { x: "0%" }); // // }); // // mm.add("(max-width: 991px)", () => { // // childDots.css("width", "0rem"); // // // Set the first dot as active and change its width // // childDots.eq(0).addClass("active").css("width", "100%"); // // gsap.set(childDots.eq(0).find(".slider_nav_line"), { x: "0%" }); // // }); // let tl2 = gsap.timeline({ repeat: -1 }); // childDots.each(function (index) { // tl2.addLabel(`step${index}`); // tl2.to($(this).find(".slider_nav_line"), { // scaleX: "1.0", // ease: "none", // duration: 9, // onComplete: () => { // goNext(index + 1); // }, // }); // }); // function moveSlide(nextIndex, forwards) { // // Remove active class from current dot and reset width // childDots.eq(activeIndex).removeClass("active").css("width", "0rem"); // // Add active class to next dot and set width // childDots.eq(nextIndex).addClass("active").css("width", "100%"); // let tl3 = gsap.timeline(); // tl3.set(childDots.eq(nextIndex).find(".slider_nav_line"), { // x: "0%", // }); // tl3.fromTo( // childDots.eq(activeIndex).find(".slider_nav_line"), // { x: "0%" }, // { x: "100%" } // ); // tl2.seek(`step${nextIndex}`); // let titleFrom = -100; // let titleDelay = "<"; // if (forwards) { // titleFrom = 100; // titleDelay = "<50%"; // } // childItems.hide(); // let prevItem = childItems.eq(activeIndex).css("display", "flex"); // let nextItem = childItems.eq(nextIndex).css("display", "flex"); // let tl = gsap.timeline({ // defaults: { duration: 1, ease: "power2.inOut" }, // }); // if (forwards) { // tl.fromTo( // nextItem, // { clipPath: "polygon(100% 0%, 100% 0%, 100% 100%, 100% 100%)" }, // { clipPath: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)" } // ); // tl.fromTo( // prevItem, // { clipPath: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)" }, // { clipPath: "polygon(0% 0%, 0% 0%, 0% 100%, 0% 100%)" }, // "<" // ); // } else { // tl.fromTo( // nextItem, // { clipPath: "polygon(0% 0%, 0% 0%, 0% 100%, 0% 100%)" }, // { clipPath: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)" } // ); // tl.fromTo( // prevItem, // { clipPath: "polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)" }, // { clipPath: "polygon(100% 0%, 100% 0%, 100% 100%, 100% 100%)" }, // "<" // ); // } // tl.fromTo( // nextItem.find(".training-option_caption .char"), // { yPercent: titleFrom }, // { yPercent: 0, duration: 1, stagger: { amount: 0.2 } }, // titleDelay // ); // tl.fromTo( // nextItem.find(".slider_eyebrow, .slider_copy_box"), // { opacity: 0 }, // { opacity: 1 }, // "<+0.2" // ); // activeIndex = nextIndex; // } // function goNext(num) { // let nextIndex = num; // if (nextIndex > totalSlides - 1) nextIndex = 0; // moveSlide(nextIndex, true); // } // childArrow.filter(".is-next").on("click", function () { // goNext(activeIndex + 1); // }); // childArrow.filter(".is-prev").on("click", function () { // let nextIndex = activeIndex - 1; // if (nextIndex < 0) nextIndex = totalSlides - 1; // moveSlide(nextIndex, false); // }); // childDots.on("click", function () { // let dotIndex = $(this).index(); // if (activeIndex > dotIndex) { // moveSlide(dotIndex, false); // } else if (activeIndex < dotIndex) { // moveSlide(dotIndex, true); // } // }); // }); // }); // } // clipSwiper(); //HOME HERO SLIDER CLOSE // FILTER TOGGLE OPEN // Regular radios $(".offer_radio").each(function (index) { $(this).on("change", function () { if ($(this).is(":checked")) { const labels = ["All", "Mind", "Body", "Fuel", "Rest"]; $(".switch").css("transform", `translateX(${index * 100}%)`); $(".switch .tagline-2").text(labels[index]); } }); }); // Handle the clear item separately $(".offer_filter_tag[first]").on("click", function () { $(".switch").css("transform", "translateX(0%)"); $(".switch .tagline-2").text("All"); }); //FILTER TOGGLE CLOSE $(".modal-slider").each(function (index) { let swiperEl = $(this).find(".swiper.modal"); let modalSwiper = new Swiper(swiperEl[0], { // autoHeight: true, slidesPerView: 3.5, speed: 800, freeMode: true, autoPlay: true, spaceBetween: 0, // momentum: true, // sticky: true, // centerInsufficientSlides: true, // simulateTouch: true, freeModeMomentumRatio: 0.1, // mousewheel: true, keyboard: true, // parallax: true, }); }); //MObIle WELLNESS POP UP // Function to open the mobile slider function mobileSliderOpen() { let mso = gsap.timeline({ paused: true, }); mso.to(".mobile-wellness_dropdown-wrap", { display: "flex", }); mso.to(".mobile-wellness_dropdown-wrap", { opacity: 1, duration: 0.2, }); mso.fromTo( ".mobile-wellness_dropdown", { opacity: 0, yPercent: -20, }, { opacity: 1, yPercent: 0, duration: 0.2, ease: "power3in.Out", onComplete: function () { lenis.stop(); }, } ); $(".wellness-dropdown_wrap .dropdown-text").on("click", function () { let theText = $(this).text(); $(this) .closest(".wellness-dropdown_wrap") .find(".dropdown-toggle_text") .text(theText); }); $(".team-filter_form .dropdown-text").on("click", function () { let theText = $(this).text(); $(this) .closest(".team-filter_form") .find(".dropdown-team_toggle") .text(theText); }); mm.add("(max-width: 991px)", () => { $(".mobile-wellness_dropdown-wrap .dropdown-text").on( "click", function () { let theText = $(this).text(); $(".mobile-wrap").find(".dropdown-toggle_text").text(theText); } ); }); // GSAP matchMedia for screen size mm.add("(max-width: 991px)", () => { // Play the timeline when .dropdown-toggle is clicked document .querySelector(".dropdown-toggle") .addEventListener("click", function () { mso.play(); }); // Reverse the timeline when .dropdown-text or .mobile-wellness_dropdown-wrap is clicked document .querySelector(".dropdown-text") .addEventListener("click", function () { mso.reverse(); lenis.start(); }); document .querySelector(".mobile-wellness_dropdown-wrap") .addEventListener("click", function () { mso.reverse(); lenis.start(); }); }); } mobileSliderOpen(); } function scanPage() { for (let i = 1; i <= 6; i++) { $(`#scan${i}`).hover( function () { $(`.scan${i}`).addClass("show"); }, function () { $(`.scan${i}`).removeClass("show"); } ); } } function aboutScript() { $(".wellness-swiper_wrap").each(function (index) { let swiperEl = $(this).find(".swiper.minds"); let wellnessSwiper = new Swiper(swiperEl[0], { grabCursor: true, slidesPerView: "auto", speed: 1000, spaceBetween: 20, momentum: true, sticky: true, keyboard: true, }); }); function mobileSliderOpen() { let mso = gsap.timeline({ paused: true, }); mso.to(".mobile-wellness_dropdown-wrap", { display: "flex", }); mso.to(".mobile-wellness_dropdown-wrap", { opacity: 1, duration: 0.2, }); mso.fromTo( ".mobile-wellness_dropdown", { opacity: 0, yPercent: -20, }, { opacity: 1, yPercent: 0, duration: 0.2, ease: "power3in.Out", onComplete: function () { lenis.stop(); }, } ); $(".wellness-dropdown_wrap .dropdown-text").on("click", function () { let theText = $(this).text(); $(this) .closest(".wellness-dropdown_wrap") .find(".dropdown-toggle_text") .text(theText); }); $(".team-filter_form .dropdown-text").on("click", function () { let theText = $(this).text(); $(this) .closest(".team-filter_form") .find(".dropdown-team_toggle") .text(theText); }); mm.add("(max-width: 991px)", () => { $(".mobile-wellness_dropdown-wrap .dropdown-text").on( "click", function () { let theText = $(this).text(); $(".mobile-wrap").find(".dropdown-toggle_text").text(theText); } ); }); // GSAP matchMedia for screen size // mm.add("(max-width: 991px)", () => { // // Play the timeline when .dropdown-toggle is clicked // document // .querySelector(".dropdown-toggle") // .addEventListener("click", function () { // mso.play(); // }); // // Reverse the timeline when .dropdown-text or .mobile-wellness_dropdown-wrap is clicked // document // .querySelector(".dropdown-text") // .addEventListener("click", function () { // mso.reverse(); // lenis.start(); // }); // document // .querySelector(".mobile-wellness_dropdown-wrap") // .addEventListener("click", function () { // mso.reverse(); // lenis.start(); // }); // }); } mobileSliderOpen(); $(".wellness-slider_holder .swiper-slide").each(function (index) { let triggerValue = $(this).attr("modal-trigger"); let relatedTrigger = $(this).find(".slide-content"); let modalWrapper = $( '.wellness-modal_item[modal-trigger="' + triggerValue + '"]' ); let modalContent = $( '.wellness-modal_item[modal-trigger="' + triggerValue + '"] .wellness-modal_right' ); let relatedBg = modalWrapper.find(".modal-bg"); let modalDuration = 0.6; let modalEase = "power2.out"; let modalTl = gsap.timeline({ paused: true, onStart: function () { lenis.stop(); }, onComplete: function () { gsap.set(relatedBg, { pointerEvents: "auto", }); }, onReverseComplete: function () { lenis.start(); gsap.set(relatedBg, { pointerEvents: "none", }); }, }); modalTl.set(".wellness-modal_wrapper", { display: "block", }); modalTl.set(modalWrapper, { display: "flex", }); // mm.add("(max-width: 991px)", () => { // modalTl.set(modalWrapper, { // position: "relative", // }); // }); modalTl.fromTo( modalContent, { xPercent: 110, }, { xPercent: 0, duration: 1, ease: "power2.out", onStart: function () { $(".wellness-modal_wrapper").scrollTop(0); }, } ); modalTl.to( ".wellness-modal_wrapper", { backdropFilter: "blur(10px)", duration: modalDuration, ease: modalEase, }, "<" ); relatedTrigger.on("click", function () { modalTl.restart(); }); relatedBg.on("click", function () { modalTl.reverse(); }); $(".wellness-modal_close").on("click", function () { modalTl.reverse(); }); }); // $(".specialist-card").each(function (index) { let triggerValue = $(this).attr("modal-trigger"); let relatedTrigger = $(this).find(".specialist-card_wrapper"); let modalWrapper = $( '.our-team-modal_item[modal-trigger="' + triggerValue + '"]' ); let modalContent = $( '.our-team-modal_item[modal-trigger="' + triggerValue + '"] .our-team-modal_right' ); let relatedBg = modalWrapper.find(".modal-bg"); let modalDuration = 0.6; let modalEase = "power2.out"; let modalTl = gsap.timeline({ paused: true, onStart: function () { lenis.stop(); }, onComplete: function () { gsap.set(relatedBg, { pointerEvents: "auto", }); }, onReverseComplete: function () { lenis.start(); gsap.set(relatedBg, { pointerEvents: "none", }); }, }); modalTl.set(".our-team-modal_wrapper", { display: "block", }); modalTl.set(modalWrapper, { display: "flex", justifyContent: "flex-end", }); modalTl.fromTo( modalContent, { xPercent: 110, }, { xPercent: 0, duration: 1, ease: "power2.out", onStart: function () { $(".our-team-modal_wrapper").scrollTop(0); }, } ); modalTl.to( ".our-team-modal_wrapper", { backdropFilter: "blur(10px)", duration: modalDuration, ease: modalEase, }, "<" ); relatedTrigger.on("click", function () { modalTl.restart(); }); relatedBg.on("click", function () { modalTl.reverse(); }); $(".our-team-modal_close-wrapper").on("click", function () { modalTl.reverse(); }); }); function animateImage() { gsap.to(".testimonial-img", { scale: 1.01, duration: 3, }); } let swiper = new Swiper(".swiper.testimonial", { autoplay: { delay: 5000, // Adjusted delay to match autoplay disableOnInteraction: false, }, on: { slideChange: function () { animateImage(); }, }, autoHeight: false, slidesPerView: 1, speed: 500, effect: "fade", fadeEffect: { crossFade: true }, loop: true, slideActiveClass: "is-active", navigation: { nextEl: ".swiper-next", prevEl: ".swiper-prev", }, }); function startProgressBar() { let progressBar = document.querySelectorAll(".slider_dot_line"); let delay = swiper.params.autoplay.delay; progressBar.forEach((bar, index) => { let isCurrentSlide = index === swiper.realIndex; bar.style.transition = isCurrentSlide ? `transform ${delay}ms linear` : "none"; bar.style.transform = isCurrentSlide ? "scaleX(1)" : "scaleX(0)"; }); } swiper.on("slideChange", startProgressBar); function handleVisibilityChange() { if (!document.hidden) { swiper.autoplay.start(); startProgressBar(); } else { swiper.autoplay.stop(); } } startProgressBar(); animateImage(); document.addEventListener("visibilitychange", handleVisibilityChange); gsap.to(".cursor, .cursor-text_holder", { opacity: 1, }); // FILTER TOGGLE OPEN // Regular radios $(".offer_radio").each(function (index) { $(this).on("change", function () { if ($(this).is(":checked")) { const labels = ["All", "Mind", "Body", "Fuel", "Rest"]; $(".switch").css("transform", `translateX(${index * 100}%)`); $(".switch .tagline-2").text(labels[index]); } }); }); // Handle the clear item separately $(".offer_filter_tag[first]").on("click", function () { $(".switch").css("transform", "translateX(0%)"); $(".switch .tagline-2").text("All"); }); //FILTER TOGGLE CLOSE } function allPage() { // $("[scroll='y-parallax']").each(function () { // let parallaxImgWrap = $(this); // let parallaxImg = parallaxImgWrap.find("img"); // const imgScrollTimeline = gsap.timeline({ // scrollTrigger: { // trigger: $(this), // start: "top bottom", // end: "bottom top", // scrub: true, // }, // }); // imgScrollTimeline.set(parallaxImg, { scale: 1.2 }); // imgScrollTimeline.fromTo( // parallaxImg, // { yPercent: 0 }, // { yPercent: 20, ease: "linear" } // ); // }); //CURSOR let cursor = Observer.create({ onMove: (self) => { let mouseX = self.x; let mouseY = self.y; gsap.to(".cursor-el", { duration: 0.3, x: mouseX, y: mouseY, ease: "power1.out", }); }, }); //CURSOR HOVERS function createHoverTimeline(attributeSelector, targetSelector) { let cursorDuration = 0.4; let cursorEase = "power3.inOut"; let theseLetters = $(targetSelector).find(".char"); let growingCursor = $(targetSelector).find(".cursor-box"); let cursorIn = gsap.timeline({ paused: true, // defaults: { overwrite: true }, }); cursorIn.to(".cursor.std", { scale: 0, duration: cursorDuration, ease: cursorEase, }); cursorIn.fromTo( $(targetSelector).find(".cursor-box"), { scale: 0, }, { scale: 1, duration: cursorDuration, ease: cursorEase, }, "<" ); if (theseLetters.length > 0) { cursorIn.fromTo( theseLetters, { yPercent: 100, opacity: 0, }, { yPercent: 0, opacity: 1, duration: cursorDuration, stagger: { amount: cursorDuration / 2 }, ease: cursorEase, }, "<50%" ); } let cursorOut = gsap.timeline({ paused: true, }); if (theseLetters.length > 0) { cursorOut.to(theseLetters, { yPercent: -100, opacity: 0, duration: cursorDuration, stagger: { amount: cursorDuration / 2 }, ease: cursorEase, }); } cursorOut.to( $(targetSelector).find(".cursor-box"), { scale: 0, duration: cursorDuration, ease: cursorEase, }, "<25%" ); cursorOut.to( ".cursor.std", { scale: 1, duration: cursorDuration, ease: cursorEase, }, "<" ); // Add hover event listeners document.querySelectorAll(attributeSelector).forEach((element) => { element.addEventListener("mouseenter", () => { cursorOut.kill(); cursorIn.restart(); }); element.addEventListener("mouseleave", () => { cursorIn.kill(); cursorOut.restart(); }); }); } // Define the timelines for each cursor createHoverTimeline("[cursor-drag]", ".cursor.drag"); createHoverTimeline("[cursor-prev]", ".cursor.prev"); createHoverTimeline("[cursor-next]", ".cursor.next"); createHoverTimeline("[cursor-play]", ".cursor.play"); createHoverTimeline("[cursor-close]", ".cursor.close"); createHoverTimeline("[cursor-learn]", ".cursor.learn"); //NAV CHANGE let navChangeTl = gsap.timeline({ paused: true, }); navChangeTl.to(".home-nav", { yPercent: -100, duration: 0.6, ease: "linear", }); ScrollTrigger.create({ start: "top top", end: 99999, onUpdate: (self) => { self.direction === -1 ? navChangeTl.reverse() : navChangeTl.play(); }, }); function navColor() { ScrollTrigger.create({ trigger: ".nav-trigger", start: "top 65%", onEnter: () => { $(".home-nav").addClass("dropped"); }, onLeaveBack: () => { $(".home-nav").removeClass("dropped"); }, }); } navColor(); // // CMS LIST SYNC POWER-UP // window.addEventListener("DOMContentLoaded", (event) => { // // attribute value checker // function attr(defaultVal, attrVal) { // let defaultValType = typeof defaultVal; // if (typeof attrVal !== "string" || attrVal.trim() === "") // return defaultVal; // if (attrVal === "true" && defaultValType === "boolean") return true; // if (attrVal === "false" && defaultValType === "boolean") return false; // if (isNaN(attrVal) && defaultValType === "string") return attrVal; // if (!isNaN(attrVal) && defaultValType === "number") return +attrVal; // return defaultVal; // } // // cms list sync component // $("[tr-listsync-element='component']").each(function (index) { // let componentEl = $(this), // cmsListEl = componentEl.find("[tr-listsync-element='list']"), // cmsItemEl = cmsListEl.children(), // prevButtonEl = componentEl.find("[tr-listsync-element='button-prev']"), // nextButtonEl = componentEl.find("[tr-listsync-element='button-next']"); // let onLoadSetting = attr(false, componentEl.attr("tr-listsync-onload")), // activeIndexSetting = attr( // 0, // componentEl.attr("tr-listsync-activeindex") // ), // activeClassSetting = attr( // "is-active", // componentEl.attr("tr-listsync-activeclass") // ); // function addActive(trigger) { // cmsItemEl.removeClass(activeClassSetting); // let itemIndex = trigger.index(); // cmsListEl.each(function () { // $(this).children().eq(itemIndex).addClass(activeClassSetting); // }); // } // if (onLoadSetting) addActive(cmsItemEl.eq(activeIndexSetting)); // cmsListEl.each(function () { // let childrenItemEl = $(this).children(), // clickSetting = attr(true, $(this).attr("tr-listsync-click")), // hoverInSetting = attr(false, $(this).attr("tr-listsync-hoverin")), // hoverOutSetting = attr(false, $(this).attr("tr-listsync-hoverout")); // if (clickSetting) { // childrenItemEl.on("click", function () { // addActive($(this)); // }); // } // if (hoverInSetting) { // childrenItemEl.on("mouseenter", function () { // addActive($(this)); // }); // } // if (hoverOutSetting) { // childrenItemEl.on("mouseleave", function () { // cmsItemEl.removeClass(activeClassSetting); // }); // } // }); // prevButtonEl.on("click", function () { // cmsListEl.each(function (index) { // let childrenItemEl = $(this).children(); // let currentItemEl = childrenItemEl // .filter("." + activeClassSetting) // .removeClass(activeClassSetting); // let prevItemEl = currentItemEl.prev(); // if (prevItemEl.length === 0) prevItemEl = childrenItemEl.last(); // prevItemEl.addClass(activeClassSetting); // }); // }); // nextButtonEl.on("click", function () { // cmsListEl.each(function (index) { // let childrenItemEl = $(this).children(); // let currentItemEl = childrenItemEl // .filter("." + activeClassSetting) // .removeClass(activeClassSetting); // let nextItemEl = currentItemEl.next(); // if (nextItemEl.length === 0) nextItemEl = childrenItemEl.first(); // nextItemEl.addClass(activeClassSetting); // }); // }); // }); // }); //SECTION ENTER function sectionEnter() { $("[section-enter]").each(function () { let sectionEl = $(this); let sE = gsap.timeline({ scrollTrigger: { trigger: sectionEl[0], start: "top 70%", end: "top 70%", toggleActions: "play none none none", }, }); sE.from(sectionEl, { opacity: 0, // filter: "blur(6px)", }); }); } sectionEnter(); $(".footer-link_holder").hover( function () { // Add class to all .footer-link except the hovered one $(".footer-link_holder").not(this).addClass("inactive"); }, function () { // Remove class when mouse leaves $(".footer-link_holder").removeClass("inactive"); } ); } function membershipPage() { mm.add("(min-width: 992px)", () => { $(".m_slider_wrap").each(function () { let childArrow = $(this).find(".slider_btn"); let childItems = $(this).find(".m_slider_change").hide(); let childDots = $(this).find(".m_slider_dot"); let childDotsHolder = $(this).find(".m_slider_holder"); let totalSlides = childItems.length; let activeIndex = 0; childItems.first().css("display", "flex"); // Set initial width for all nav items // childDots.css("width", "0.25rem"); // // Set the first dot as active and change its width // childDots.eq(0).addClass("active").css("width", "80%"); // gsap.set(childDots.eq(0).find(".m_slider_line"), { x: "0%" }); let tl2 = gsap.timeline({ repeat: -1 }); childDots.each(function (index) { tl2.addLabel(`step${index}`); tl2.to($(this).find(".m_slider_line"), { scaleX: "1.0", ease: "none", duration: 5, onComplete: () => { goNext(index + 1); }, }); }); function moveSlide(nextIndex, forwards) { // Remove active class from current dot and reset width // childDots.eq(activeIndex).removeClass("active").css("width", "0.25rem"); // // Add active class to next dot and set width // childDots.eq(nextIndex).addClass("active").css("width", "80%"); let tl3 = gsap.timeline(); tl3.set(childDots.eq(nextIndex).find(".m_slider_line"), { x: "0%" }); tl3.fromTo( childDots.eq(activeIndex).find(".m_slider_line"), { x: "0%" }, { x: "100%" } ); tl2.seek(`step${nextIndex}`); let titleFrom = -100; let titleDelay = "<"; if (forwards) { titleFrom = 100; titleDelay = "<50%"; } childItems.hide(); let prevItem = childItems.eq(activeIndex).css("display", "flex"); let nextItem = childItems.eq(nextIndex).css("display", "flex"); let tl = gsap.timeline({ defaults: { duration: 1, ease: "power2.inOut" }, }); if (forwards) { tl.fromTo( nextItem, { xPercent: 100, opacity: 0 }, { xPercent: 0, opacity: 1 } ); tl.to(prevItem, { xPercent: -50, opacity: 0, scale: 0.95 }, "<"); } else { tl.fromTo( nextItem, { xPercent: -50, opacity: 0 }, { xPercent: 0, opacity: 1 } ); tl.to(prevItem, { xPercent: 100, opacity: 0, scale: 0.95 }, "<"); } // tl.fromTo( // nextItem.find(".training-option_caption .char"), // { yPercent: titleFrom }, // { yPercent: 0, duration: 1, stagger: { amount: 0.2 } }, // titleDelay // ); // tl.fromTo( // nextItem.find(".slider_eyebrow, .slider_copy_box"), // { opacity: 0 }, // { opacity: 1 }, // "<+0.2" // ); // tl.fromTo( // nextItem.find(".training-option_caption .char"), // { yPercent: titleFrom }, // { yPercent: 0, duration: 1, stagger: { amount: 0.2 } }, // titleDelay // ); tl.fromTo( nextItem.find(".m_card"), { opacity: 0 }, { opacity: 1 }, "<+0.2" ); activeIndex = nextIndex; } function goNext(num) { let nextIndex = num; if (nextIndex > totalSlides - 1) nextIndex = 0; moveSlide(nextIndex, true); } childArrow.filter(".is-next").on("click", function () { goNext(activeIndex + 1); }); childArrow.filter(".is-prev").on("click", function () { let nextIndex = activeIndex - 1; if (nextIndex < 0) nextIndex = totalSlides - 1; moveSlide(nextIndex, false); }); childDotsHolder.on("click", function () { let dotIndex = $(this).index(); if (activeIndex > dotIndex) { moveSlide(dotIndex, false); } else if (activeIndex < dotIndex) { moveSlide(dotIndex, true); } }); }); }); } function mobileMenu() { //MENU OPEN function menuPop() { let mp = gsap.timeline({ paused: true, }); $(".menu-icon_holder").on("click", function () { $(".menu-icon_wrap").css("display", "flex"); $(this).addClass("is-active"); mp.timeScale(1); mp.restart(); lenis.stop(); }); mp.to(".menu-overlay", { opacity: 1, duration: 0.4, }); mp.to(".menu-wrap", { xPercent: -100, duration: 0.4, onComplete: function () { document.querySelector(".menu-close").classList.add("is-active"); }, }); mp.fromTo( ".nav-logo", { color: "", }, { color: "#000", duration: 0.1, }, "<+0.3" ); mp.fromTo( ".menu-link_text .char", { yPercent: 200, }, { yPercent: 0, duration: 0.6, stagger: { each: 0.02 }, ease: "linear", }, "<" ); mp.to( ".menu-bot", { opacity: 1, duration: 1, }, "<0.7" ); } mm.add("(max-width: 991px)", () => { menuPop(); }); //MENU CLOSE function menuPopOut() { let mpo = gsap.timeline({ paused: true, }); $(".menu-close").on("click", function () { $(this).removeClass("is-active"); mpo.timeScale(2); mpo.restart(); lenis.start(); }); mpo.to(".menu-bot", { opacity: 0, duration: 1, }); mpo.to( ".menu-link_text .char", { yPercent: -200, duration: 0.6, stagger: { each: 0.02 }, ease: "linear", }, "<" ); mpo.to( ".nav-logo", { color: "", duration: 0.1, }, "<+0.5" ); mpo.to(".menu-wrap", { xPercent: 0, duration: 0.4, onComplete: function () { document .querySelector(".menu-icon_holder") .classList.remove("is-active"); }, }); mpo.to(".menu-overlay", { opacity: 0, duration: 0.4, }); } mm.add("(max-width: 991px)", () => { menuPopOut(); }); } function footerPlay() { function footerLoader() { let fl = gsap.timeline({ scrollTrigger: { trigger: ".footer-section", start: "top 50%", end: "top 500%", toggleActions: "play none none none", }, }); gsap.matchMedia().add("(min-width: 992px)", () => { fl.fromTo( ".footer-heading .char", { opacity: 0, // filter: "blur(6px)", yPercent: 100, }, { yPercent: 0, opacity: 1, // filter: "blur(0px)", duration: 0.4, stagger: { each: 0.01 }, ease: "power3.out", } ); }); } footerLoader(); function rollProfiles() { let profileRoll = gsap.timeline({ scrollTrigger: { trigger: ".footer-profile.i", start: "top 90%", end: "top 90%", toggleActions: "play none none none", }, }); profileRoll.from(".footer-profile.i", { x: 0, rotate: 45, }); profileRoll.from( ".footer-profile.ii", { x: 0, rotate: 45, }, "<" ); profileRoll.from( ".footer-profile.iii", { x: 0, rotate: -45, }, "<" ); profileRoll.from( ".footer-profile.iv", { x: 0, rotate: -45, }, "<" ); } rollProfiles(); } function contactPage() { $("#Message-3").on("keydown", function (e) { if (e.key === "Enter" && !e.shiftKey) { e.stopPropagation(); // prevent bubbling to form } }); $(document).click(function (event) { $(".contact-field").each(function () { if ($(event.target).is(this)) { $(this).css("border", "1px solid white"); } else { $(this).css("border", "none"); } }); }); } function policyPages() { //MObIle PRIVACY POLICY POP UP OPEN // Function to open the mobile slider function ppDropOpen() { let pdo = gsap.timeline({ paused: true, }); pdo.to(".pp-dropdown_wrap", { display: "flex", }); pdo.to(".pp-dropdown_wrap", { opacity: 1, duration: 0.2, }); pdo.fromTo( ".pp-dropdown", { opacity: 0, yPercent: -20, }, { opacity: 1, yPercent: 0, duration: 0.2, ease: "power3in.Out", onComplete: function () { lenis.stop(); }, } ); // GSAP matchMedia for screen size mm.add("(max-width: 991px)", () => { // Play the timeline when .dropdown-toggle is clicked document .querySelector(".pp-dropdown_arrow") .addEventListener("click", function () { pdo.play(); }); // Reverse the timeline when .dropdown-text or .mobile-wellness_dropdown-wrap is clicked document.querySelector(".pp-link").addEventListener("click", function () { pdo.reverse(); lenis.start(); }); document .querySelector(".pp-dropdown_wrap") .addEventListener("click", function () { pdo.reverse(); lenis.start(); }); }); } } function stdPageTransition() { // Page load let ptl = gsap.timeline(); $(".pt-gradient_holder").each(function () { let paths = $(this).find("path"); ptl.fromTo( paths, { opacity: 1, }, { opacity: 0, duration: 0.6, stagger: { amount: 0.5, }, } ); ptl.to( ".page-wrap", { opacity: 1, }, "<" ); }); ptl.set(".transition_wrap", { display: "none" }); // Link click $("a:not(.excluded-class)").on("click", function (e) { let currentUrl = $(this).attr("href"); if ( $(this).prop("hostname") === window.location.host && !currentUrl.includes("#") && $(this).attr("target") !== "_blank" ) { e.preventDefault(); lenis.stop(); let ptl = gsap.timeline({ onComplete: () => (window.location.href = currentUrl), }); ptl.set(".transition_wrap", { display: "flex" }); $(".pt-gradient_holder").each(function () { let paths = $(this).find("path"); ptl.fromTo( paths, { opacity: 0, }, { opacity: 1, duration: 0.1, stagger: { amount: 1, }, } ); }); } }); // On Back Button Tap window.onpageshow = function (event) { if (event.persisted) window.location.reload(); }; } function menuHolderShow() { let menuHolderShow = gsap.timeline(); menuHolderShow.fromTo( ".menu-icon_holder", { opacity: 0, }, { delay: 1, opacity: 1, duration: 0.1, } ); } function stdNavLogo() { gsap.to(".nav-logo", { opacity: 1, }); } // document.addEventListener("DOMContentLoaded", function () { // var svgHolder = document.querySelector(".preloader-svg_holder"); // var svg = document.querySelector(".preloader-gradient"); // function resizeSVG() { // svg.setAttribute("width", svgHolder.clientWidth + "px"); // svg.setAttribute("height", svgHolder.clientHeight + "px"); // if (window.panZoom) { // window.panZoom.resize(); // window.panZoom.fit(); // window.panZoom.center(); // } // } // // Initial resize // resizeSVG(); // // Initialize svg-pan-zoom if needed // window.panZoom = svgPanZoom(svg, {}); // // Resize on window resize // window.addEventListener("resize", resizeSVG); // }); function classPage() { $("#class").prop("checked", true); $(".toggle_switch_text").text("Class Schedule"); $(".price_switch").css("transform", "translateX(0%)"); $(".membership_schedule").css({ display: "block", opacity: 1 }); $(".membership_classes").css({ display: "none", opacity: 0 }); function showSchedule() { $(".toggle_switch_text").text("Class Schedule"); $(".price_switch").css("transform", "translateX(0%)"); $(".membership_classes").css("display", "none"); $(".membership_schedule").css("display", "block"); gsap.to(".membership_schedule", { opacity: 1, duration: 1, ease: "power2.out", }); } function showClasses() { $(".toggle_switch_text").text("Classes & Pricing"); $(".price_switch").css("transform", "translateX(100%)"); $(".membership_schedule").css("display", "none"); $(".membership_classes").css("display", "block"); gsap.to(".membership_classes", { opacity: 1, duration: 1, ease: "power2.out", }); } $("#class").change(function () { if ($(this).is(":checked")) showSchedule(); }); $("#price").change(function () { if ($(this).is(":checked")) showClasses(); }); } ///PILLAR SCRIPT /// function fourPillarsl() { //4 PILLARS ANIMATION let pillarSplit; function runSplit() { pillarSplit = new SplitType("[pillar-split]", { types: "lines, words, chars", }); } runSplit(); gsap.set(".pillar-head_text .char", { opacity: 0, yPercent: 150, }); $(".lottie-component").each(function (index) { let lottieFile = $(this).find(".lottie-el"); let lottieUrl = lottieFile.attr("lottie-url"); let lottieAnimation = bodymovin.loadAnimation({ container: lottieFile[0], renderer: "svg", autoplay: false, loop: false, path: lottieUrl, onStart: () => { gsap.to(".pillars-holder", { opacity: 1, ease: "power4.inOut", duration: 1, }); }, }); lottieAnimation.setSpeed(2); let pillarsLoadInTimeline = gsap.timeline({ scrollTrigger: { trigger: ".pillars-section", start: "top top", toggleActions: "play none none none", }, }); mm.add("(min-width: 992px)", () => { // gsap.set(".right-stag_text .char", { // opacity: 0, // yPercent: 150, // }); // pillarsLoadInTimeline.timeScale(10); pillarsLoadInTimeline.to( ".pillars-head .word", { yPercent: -150, ease: "expo.out", duration: 1, stagger: { each: 0.05, }, onStart: () => { lenis.stop(); }, }, "<" ); pillarsLoadInTimeline.to( ".pillars-foot .word", { yPercent: 150, ease: "expo.out", duration: 1, stagger: { each: 0.05, }, }, "<" ); pillarsLoadInTimeline.to( ".pillars-head, .pillars-foot", { opacity: 1, // filter: "blur(0px)", ease: "expo.out", duration: 0.3, }, "<" ); pillarsLoadInTimeline.to( ".pillars-head, .pillars-foot", { opacity: 0, duration: 0.3, onStart: () => { lottieAnimation.play(); }, }, "<" ); // pillarsLoadInTimeline.to( // ".pillars-holder", // { // opacity: 1, // ease: "power4.inOut", // duration: 1, // }, // "<+2", // ); pillarsLoadInTimeline.fromTo( ".pillars-svg_holder", { scale: 0, rotateZ: 0, }, { scale: 1, rotate: 90, stagger: { each: 0.1, }, duration: 0.6, overwrite: "auto", } ), "<"; pillarsLoadInTimeline.fromTo( ".pillars-underline", { opacity: 0, width: "0%", }, { opacity: 0.3, width: "100%", ease: "power4.inOut", duration: 1, stagger: { each: 0.2, }, }, "<" ); pillarsLoadInTimeline.fromTo( ".pillars-text", { xPercent: -50, opacity: 0, }, { xPercent: 0, opacity: 1, ease: "power4.inOut", duration: 1, stagger: { amount: 0.2, each: 0.2, }, }, "<" ); // pillarsLoadInTimeline.from( // ".pillars-description_head .char", // { // xPercent: -10, // yPercent: 150, // ease: "power4.inOut", // stagger: { // each: 0.05, // }, // duration: 0.4, // }, // "<", // ); pillarsLoadInTimeline.fromTo( ".pillars-right_initial", { opacity: 0, }, { opacity: 1, ease: "power4.inOut", duration: 1, clearProps: "all", }, "<" ); pillarsLoadInTimeline.fromTo( ".pillars-left_wrap", { pointerEvents: "none", }, { pointerEvents: "auto", }, "<" ); pillarsLoadInTimeline.to( ".pillar", { pointerEvents: "auto", }, "<" ); pillarsLoadInTimeline.fromTo( ".pillars-intro_text .char", { opacity: 0, xPercent: -10, yPercent: 150, }, { opacity: 1, xPercent: 0, yPercent: 0, ease: "power4.inOut", stagger: { each: 0.05, }, duration: 0.4, }, "<" ); pillarsLoadInTimeline.to( ".wellness-intro_text", { opacity: 1, ease: "power4.inOut", duration: 1, onStart: () => { lenis.start(); }, }, "<" ); }); }); //MOBILE PILLARS END $(".pillar").on("mouseenter", function () { var index = $(this).index(".pillar"); $(".pillars-right_initial").removeClass("is-active"); $(".pillars-description_item").removeClass("is-active"); $(".pillars-description_item").eq(index).addClass("is-active"); $(".pillar .pillar-overlay").removeClass("active"); $(this).siblings(".pillar").find(".pillar-overlay").addClass("active"); pillarsLeaveTimeline(".wellness-intro_text"); }); $(".pillar").on("mouseleave", function () { $(".pillars-description_item").removeClass("is-active"); $(".pillar .pillar-overlay").removeClass("active"); $(".pillars-right_initial").addClass("is-active"); pillarsEnterTimeline(".wellness-intro_text"); }); $(".desktop-pillar").on("mouseenter", function () { var index = $(this).index(".desktop-pillar"); $(".pillar").eq(index).trigger("mouseenter"); }); $(".desktop-pillar").on("mouseleave", function () { var index = $(this).index(".desktop-pillar"); $(".pillar").eq(index).trigger("mouseleave"); }); $(".desktop-pillar").on("click", function () { var index = $(this).index(".desktop-pillar"); $(".pillar").eq(index).trigger("click"); }); function pillarsEnterTimeline(selector) { let pillars = gsap.timeline(); pillars.fromTo( `${selector} .char`, { opacity: 0, yPercent: 150, }, { opacity: 1, yPercent: 0, ease: "expo.out", duration: 1, stagger: { each: 0.02, }, // overwrite: "auto", } ); return pillars; } function pillarsLeaveTimeline(selector) { let pillars = gsap.timeline(); pillars.to(`${selector} .char`, { opacity: 0, yPercent: -150, ease: "expo.out", duration: 1, stagger: { each: 0.02, }, overwrite: true, }); return pillars; } function setupPillarInteraction(pillarClass, bgClass, textClass) { $(`.pillar.${pillarClass}`).on("mouseenter", function () { $(`.${bgClass}`).addClass("is-active"); pillarsEnterTimeline(textClass); }); $(`.pillar.${pillarClass}`).on("mouseleave", function () { $(`.${bgClass}`).removeClass("is-active"); pillarsLeaveTimeline(textClass); }); } setupPillarInteraction("mind", "bg-mind", ".pillar-head_text.mind"); setupPillarInteraction("body", "bg-body", ".pillar-head_text.body"); setupPillarInteraction("fuel", "bg-fuel", ".pillar-head_text.fuel"); setupPillarInteraction("rest", "bg-rest", ".pillar-head_text.rest"); } fourPillarsl(); function pillarCursor(attributeSelector, targetSelector) { let cursorDuration = 0.4; let cursorEase = "power3.inOut"; let theseLetters = $(targetSelector).find(".char"); let growingCursor = $(targetSelector).find(".cursor-box"); let pillarIn = gsap.timeline({ paused: true, }); pillarIn.to( $(targetSelector).find(".cursor-box"), { opacity: 1, scale: 1, duration: cursorDuration, ease: cursorEase, }, "<" ); if (theseLetters.length > 0) { pillarIn.fromTo( theseLetters, { yPercent: 100, opacity: 0, }, { yPercent: 0, opacity: 1, duration: cursorDuration, stagger: { amount: cursorDuration / 2 }, ease: cursorEase, }, "<50%" ); } let pillarOut = gsap.timeline({ paused: true, }); if (theseLetters.length > 0) { pillarOut.to(theseLetters, { yPercent: -100, opacity: 0, duration: cursorDuration, stagger: { amount: cursorDuration / 2 }, ease: cursorEase, }); } pillarOut.to( $(targetSelector).find(".cursor-box"), { opacity: 0, duration: cursorDuration, ease: cursorEase, }, "<25%" ); // Add hover event listeners document.querySelectorAll(attributeSelector).forEach((element) => { element.addEventListener("mouseenter", () => { pillarOut.kill(); pillarIn.restart(); }); element.addEventListener("mouseleave", () => { pillarIn.kill(); pillarOut.restart(); }); }); $(".pillars-main_component").on("mouseenter", function () { gsap.to(".cursor.std", { scale: 0, duration: cursorDuration, ease: cursorEase, }); }); $(".pillars-main_component").on("mouseleave", function () { gsap.to(".cursor.std", { scale: 1, duration: cursorDuration, ease: cursorEase, delay: 0.4, }); }); } // Define the timelines for each cursor //PILLARS pillarCursor("[cursor-mind]", ".pillar-cursor.mind"); pillarCursor("[cursor-body]", ".pillar-cursor.body"); pillarCursor("[cursor-fuel]", ".pillar-cursor.fuel"); pillarCursor("[cursor-rest]", ".pillar-cursor.rest"); //METHOD MODAL $(".pillar").each(function (index) { let modalItems = $(".method-modal_item"); let targetModalItem = modalItems.eq(index); let modalWrapper = $(".method-modal_wrapper"); let relatedBg = targetModalItem.find(".modal-bg"); let modalDuration = 0.6; let modalEase = "power2.out"; let methodTl = gsap.timeline({ paused: true, onStart: function () { lenis.stop(); }, onReverseComplete: function () { lenis.start(); }, }); methodTl.set(".method-modal_wrapper", { display: "flex", }); methodTl.set(targetModalItem, { display: "flex", }); methodTl.fromTo( ".method-modal_right", { xPercent: 110, }, { xPercent: 0, duration: 1, ease: "expo.out", onStart: function () { $(".method-modal_wrapper").scrollTop(0); }, } ); methodTl.to( relatedBg, { opacity: 1, duration: modalDuration, ease: modalEase, }, "<" ); methodTl.set(relatedBg, { pointerEvents: "auto", }); $(this).on("click", function () { gsap.to(targetModalItem, { opacity: 1, duration: modalDuration, ease: modalEase, }); methodTl.restart(); }); relatedBg.on("click", function () { methodTl.reverse(); }); mm.add("(max-width: 991px)", () => { $(".mobile-modal_trigger").each(function (index) { $(this).on("click", function () { $(".pillar").eq(index).trigger("click"); }); }); $(".method-modal_close").on("click", function () { methodTl.reverse(); }); }); }); mm.add("(max-width: 991px)", () => { let currentOpenItem = null; document.querySelectorAll(".pillars-item").forEach((item) => { const drop = item.querySelector(".pillars-item_drop"); let height = 0; gsap.set(drop, { height: "auto" }); height = drop.offsetHeight; gsap.set(drop, { height: 0 }); item.addEventListener("click", (e) => { e.stopPropagation(); const isOpen = gsap.getProperty(drop, "height") !== 0; if (currentOpenItem && currentOpenItem !== item) { const currentDrop = currentOpenItem.querySelector(".pillars-item_drop"); gsap.to(currentDrop, { height: 0, duration: 0.3, ease: "power1.inOut", }); } gsap.to(drop, { height: isOpen ? 0 : height, duration: 0.3, ease: "power1.inOut", }); currentOpenItem = isOpen ? null : item; }); }); document.addEventListener("click", () => { if (currentOpenItem) { const currentDrop = currentOpenItem.querySelector(".pillars-item_drop"); gsap.to(currentDrop, { height: 0, duration: 0.3, ease: "power1.inOut", }); currentOpenItem = null; } }); }); // let windowWidth = $(window).innerWidth(); // window.addEventListener("resize", function () { // if (windowWidth !== $(window).innerWidth()) { // windowWidth = $(window).innerWidth(); // // lenis.resize(); // // ScrollTrigger.refresh(); // } // }); //CURSOR // document.addEventListener("DOMContentLoaded", () => { function createHoverTimeline(attributeSelector, targetSelector) { let cursorDuration = 0.4; let cursorEase = "power3.inOut"; let theseLetters = $(targetSelector).find(".char"); let growingCursor = $(targetSelector).find(".cursor-box"); let cursorIn = gsap.timeline({ paused: true, }); cursorIn.to(".cursor.std", { scale: 0, duration: cursorDuration, ease: cursorEase, }); cursorIn.fromTo( $(targetSelector).find(".cursor-box"), { scale: 0, }, { scale: 1, duration: cursorDuration, ease: cursorEase, }, "<" ); if (theseLetters.length > 0) { cursorIn.fromTo( theseLetters, { yPercent: 100, opacity: 0, }, { yPercent: 0, opacity: 1, duration: cursorDuration, stagger: { amount: cursorDuration / 2 }, ease: cursorEase, }, "<50%" ); } let cursorOut = gsap.timeline({ paused: true, }); if (theseLetters.length > 0) { cursorOut.to(theseLetters, { yPercent: -100, opacity: 0, duration: cursorDuration, stagger: { amount: cursorDuration / 2 }, ease: cursorEase, }); } cursorOut.to( $(targetSelector).find(".cursor-box"), { scale: 0, duration: cursorDuration, ease: cursorEase, }, "<25%" ); cursorOut.to( ".cursor.std", { scale: 1, duration: cursorDuration, ease: cursorEase, }, "<" ); document.querySelectorAll(attributeSelector).forEach((element) => { element.addEventListener("mouseenter", () => { cursorOut.kill(); cursorIn.restart(); }); element.addEventListener("mouseleave", () => { cursorIn.kill(); cursorOut.restart(); }); }); } createHoverTimeline("[cursor-plus]", ".cursor.plus"); const handleMobileMenu = () => { const mobileBookNowBtn = document.querySelector(".menu-btn_book-now"); const mobileBackBtn = document.querySelector(".back-btn"); const mobileLogo = document.querySelector(".nav-logo_wrap"); const alternativeLogo = document.querySelector( ".alternative-nav-logo_wrap" ); const menuCloseBtn = document.querySelector(".menu-close"); const homeNav = document.querySelector(".home-nav"); const alternativeNav = document.querySelector(".alternative-nav"); const menuBook = document.querySelector(".menu-book"); menuBook.classList.add("menu-second-step"); let step = 1; mobileBookNowBtn.addEventListener("click", () => { step++; if (alternativeNav) { alternativeNav.classList.add("alternative-nav_without-background"); } menuBook.classList.remove("menu-second-step"); menuBook.classList.add("menu-second-step_active"); if (mobileLogo) { mobileLogo.style.visibility = "hidden"; mobileLogo.style.pointerEvents = "none"; } else { alternativeLogo.style.visibility = "hidden"; alternativeLogo.style.pointerEvents = "none"; } mobileBackBtn.style.visibility = "visible"; mobileBackBtn.style.pointerEvents = "auto"; if (homeNav) { homeNav.style.pointerEvents = "none"; } else { alternativeNav.style.pointerEvents = "none"; } }); mobileBackBtn.addEventListener("click", () => { if (mobileLogo) { mobileLogo.style.visibility = "visible"; mobileLogo.style.pointerEvents = "auto"; } else { alternativeLogo.style.visibility = "visible"; alternativeLogo.style.pointerEvents = "auto"; } menuBook.classList.add("menu-second-step"); menuBook.classList.remove("menu-second-step_active"); if (homeNav) { homeNav.style.pointerEvents = "auto"; } else { alternativeNav.style.pointerEvents = "auto"; } step--; }); menuCloseBtn.addEventListener("click", () => { if (!menuCloseBtn.classList.contains("is-active") && step > 1) { if (mobileLogo) { mobileLogo.style.visibility = "visible"; mobileLogo.style.pointerEvents = "auto"; } else { alternativeLogo.style.visibility = "visible"; alternativeLogo.style.pointerEvents = "auto"; } mobileBackBtn.style.visibility = "hidden"; mobileBackBtn.style.pointerEvents = "none"; if (homeNav) { homeNav.style.pointerEvents = "auto"; } else { alternativeNav.style.pointerEvents = "auto"; } step--; menuBook.classList.remove("menu-second-step_active"); menuBook.classList.add("menu-second-step"); } }); }; handleMobileMenu(); });