{"version":3,"file":"kids.min.js","sources":["kids.min.js"],"sourcesContent":["'use strict';\n\n/**\n * @description Initialize event handlers on landing page\n */\n\nwindow.addEventListener('mainJsLoaded', function () {\n kidsInit();\n});\n\nfunction kidsInit() {\n // FEATURE 1 - Animations\n kidsAnimationsInit();\n\n // FEATURE 2 - Mobile carousel tiggers\n kidsMobileCarouselsInit();\n\n // FEATURE 3 - Desktop custom tiggers\n kidsDesktopCustomTiggersInit();\n}\n\n/* FEATURE 1 - Animations */\nfunction kidsAnimationsInit() {\n var prevTopScroll = 0,\n $kidsAnimation1 = $('.js-kids-animation-1'),\n kidsAnimation1Offset = 0,\n $kidsAnimation1Bottom = $('.js-kids-animation-1-bottom'),\n kidsAnimation1BottomOffset = 0,\n $kidsAnimation2 = $('.js-kids-animation-2'),\n kidsAnimation2Offset = 0,\n $kidsAnchors = $('.js-kids-anchor');\n\n window.addEventListener('scroll', function () {\n // desktop animation only\n if (window.vbqUtils.breakpoint.is('fromDesktop')) {\n var currentTopScroll = window.pageYOffset,\n currentScroll = currentTopScroll / window.innerHeight;\n\n if ($kidsAnimation1.length) {\n kidsAnimation1Offset = $kidsAnimation1.offset().top / window.innerHeight;\n document.body.style.setProperty('--scrolloffset1', kidsAnimation1Offset);\n }\n\n // for activation of fixed position on animation 1 if custom anchors reset it\n if ($kidsAnimation1Bottom.length) {\n kidsAnimation1BottomOffset = $kidsAnimation1Bottom.offset().top / window.innerHeight;\n }\n\n if ($kidsAnimation2.length) {\n kidsAnimation2Offset = $kidsAnimation2.offset().top / window.innerHeight;\n document.body.style.setProperty('--scrolloffset2', kidsAnimation2Offset);\n }\n\n document.body.style.setProperty('--scroll', currentScroll);\n\n // scroll down\n if (currentTopScroll > prevTopScroll) {\n // activate fixed position on animation 1\n if (currentScroll >= kidsAnimation1Offset && !$kidsAnimation1.hasClass('stop-animation')) {\n $kidsAnimation1.addClass('animate');\n }\n\n // activate fixed position on animation 2\n if (currentScroll >= kidsAnimation2Offset) {\n $kidsAnimation2.addClass('animate');\n }\n\n // activate bottom position on animation 2 - stop phase ( + 1 viewports)\n if (currentScroll >= kidsAnimation2Offset + 1) {\n $kidsAnimation2.addClass('bottom').removeClass('animate');\n }\n } else {\n // scroll up\n // activate fixed position on animation 2 ( + 1 viewports)\n if (currentScroll < kidsAnimation2Offset + 1) {\n $kidsAnimation2.addClass('animate').removeClass('bottom');\n }\n\n // deactivate fixed position on animation 2\n if (currentScroll < kidsAnimation2Offset) {\n $kidsAnimation2.removeClass('animate');\n }\n\n // activate fixed position on animation 1 if custom anchors reset it\n if (currentScroll < kidsAnimation1BottomOffset) {\n $kidsAnimation1.addClass('animate').removeClass('stop-animation');\n }\n\n // deactivate fixed position on animation 1\n if (currentScroll < kidsAnimation1Offset) {\n $kidsAnimation1.removeClass('animate');\n }\n }\n\n // update prevTopScroll\n prevTopScroll = currentTopScroll;\n }\n }, false);\n\n // activate custom anchors to fix issue with animation scroll\n $kidsAnchors.on('click keydown', function (e) {\n // mouse click or enter/space key\n if (e.type == 'click' || (e.type == 'keydown' && (e.keyCode == 13 || e.keyCode == 32))) {\n // prevent the default action to stop scrolling when space is pressed\n e.preventDefault();\n\n var $control = $(this),\n $target = $($control.attr('href'));\n\n // deactivate animation for proper top scroll position\n $kidsAnimation1.addClass('stop-animation').removeClass('animate');\n\n window.vbqUtils.cache.$html.animate({\n scrollTop: $target.offset().top\n }, 10);\n }\n });\n\n // remove desktop animations\n window.vbqUtils.breakpoint.set([\n {\n media: window.vbqUtils.breakpoint.getMediaQuery('mobileAndTablet'),\n enter: function () {\n $kidsAnimation1.removeClass('animate').addClass('stop-animation');\n $kidsAnimation2.removeClass('animate').removeClass('bottom');\n }\n }\n ]);\n}\n\n/* FEATURE 2 - Mobile carousel tiggers */\nfunction kidsMobileCarouselsInit() {\n var $kidsMobileLifestyleCarousels = $('.js-mobile-lifestyle-carousel'),\n $allKidsMobileLifestyleControls = $('.js-mobile-lifestyle-control');\n\n // sync triggers with carousel state\n $kidsMobileLifestyleCarousels.on('beforeChange', function (event, slick, currentSlide, nextSlide) {\n var $this = $(this),\n $controls = $this.next('.js-mobile-lifestyle-nav').find('.js-mobile-lifestyle-control');\n\n $controls.removeClass('active').filter('[data-index=\"' + nextSlide + '\"]').addClass('active');\n });\n\n // setup mobile lifestyle carousel\n window.vbqUtils.breakpoint.set([\n {\n media: window.vbqUtils.breakpoint.getMediaQuery('mobile'),\n enter: function () {\n $kidsMobileLifestyleCarousels.slick({\n slidesToShow: 1,\n dots: false,\n arrows: false,\n infinite: false\n });\n\n $kidsMobileLifestyleCarousels.each(function () {\n var $carousel = $(this),\n $controls = $carousel.next('.js-mobile-lifestyle-nav').find('.js-mobile-lifestyle-control');\n\n $controls.first().addClass('active') ;\n });\n }\n },\n {\n media: window.vbqUtils.breakpoint.getMediaQuery('tabletAndDesktop'),\n enter: function () {\n if ($kidsMobileLifestyleCarousels.hasClass('slick-initialized')) {\n $kidsMobileLifestyleCarousels.slick('unslick');\n }\n\n $allKidsMobileLifestyleControls.removeClass('active');\n }\n }\n ]);\n\n $allKidsMobileLifestyleControls.on('click keydown', function (e) {\n // mouse click or enter key\n if (e.type == 'click' || (e.type == 'keydown' && e.keyCode == 13)) {\n var $control = $(this),\n $nav = $control.parent('.js-mobile-lifestyle-nav'),\n $controls = $nav.find('.js-mobile-lifestyle-control'),\n $carousel = $nav.prev('.js-mobile-lifestyle-carousel');\n\n if (window.vbqUtils.breakpoint.is('mobile')) {\n if ($carousel.hasClass('slick-initialized')) {\n $controls.removeClass('active');\n $carousel.slick('slickGoTo', $control.data('index'));\n $control.addClass('active');\n }\n }\n }\n });\n}\n\n/* FEATURE 3 - Desktop custom tiggers */\nfunction kidsDesktopCustomTiggersInit() {\n var $kidsDesktopCustomCarousels = $('.js-desktop-custom-carousel'),\n $kidsDesktopCustomControls = $('.js-desktop-custom-control');\n\n // 2 sections: section 4 & section 6\n $kidsDesktopCustomCarousels.each(function () {\n var $carousel = $(this),\n // carousel-index = 0 - section 4 & carousel-index = 1 - section 6\n carouselIndex = $carousel.data('carousel-index');\n\n document.body.style.setProperty('--customIndex' + carouselIndex, 0);\n });\n\n // adjust css vars on scroll / resize to calculate accurately on lazyloaded images\n window.addEventListener('scroll', function () {\n if (window.vbqUtils.breakpoint.is('tabletAndDesktop')) {\n $kidsDesktopCustomCarousels.each(function () {\n var $carousel = $(this),\n // carousel-index = 0 - section 4 & carousel-index = 1 - section 6\n carouselIndex = $carousel.data('carousel-index'),\n $controls = $carousel.find('.js-desktop-custom-control'),\n $images = $carousel.find('.js-desktop-custom-carousel-image'),\n customBgHeight = $images.first().height(),\n $products = $carousel.find('.js-desktop-custom-carousel-product'),\n customProductHeight = $products.first().outerHeight();\n\n // adjust transition height\n document.body.style.setProperty('--customBgHeight' + carouselIndex, customBgHeight);\n document.body.style.setProperty('--customBgHeightPx' + carouselIndex, customBgHeight + 'px');\n document.body.style.setProperty('--customHeightPx' + carouselIndex, customBgHeight * $controls.length + 'px');\n\n // adjust product transition height\n document.body.style.setProperty('--customProductHeight' + carouselIndex, customProductHeight);\n document.body.style.setProperty('--customProductHeightPx' + carouselIndex, customProductHeight + 'px');\n document.body.style.setProperty('--customTotalProductHeightPx' + carouselIndex, customProductHeight * $controls.length + 'px');\n });\n }\n });\n\n // sync tabs & block state\n $kidsDesktopCustomControls.on('click keydown', function (e) {\n // mouse click or enter key\n if (e.type == 'click' || (e.type == 'keydown' && e.keyCode == 13)) {\n\n if (window.vbqUtils.breakpoint.is('tabletAndDesktop')) {\n var $this = $(this),\n index = $this.data('index'),\n carouselIndex = $this.data('carousel-index'),\n $groupControls = $kidsDesktopCustomControls.filter('[data-carousel-index=\"' + carouselIndex + '\"]'),\n $groupCarousel = $kidsDesktopCustomCarousels.filter('[data-carousel-index=\"' + carouselIndex + '\"]'),\n $productLinks = $groupCarousel.find('.js-desktop-custom-carousel-product-link');\n\n // trigger slide transition\n document.body.style.setProperty('--customIndex' + carouselIndex, index);\n\n $groupControls.removeClass('active').filter('[data-index=\"' + index + '\"]').addClass('active');\n\n // change product link accessibility\n $productLinks.attr('tabindex', '-1').filter('[data-index=\"' + index + '\"]').attr('tabindex', '0');\n }\n }\n });\n\n // reset desktop custom tiggers\n window.vbqUtils.breakpoint.set([\n {\n media: window.vbqUtils.breakpoint.getMediaQuery('mobile'),\n enter: function () {\n $kidsDesktopCustomCarousels.each(function () {\n var $carousel = $(this),\n // carousel-index = 0 - section 4 & carousel-index = 1 - section 6\n carouselIndex = $carousel.data('carousel-index'),\n $controls = $carousel.find('.js-desktop-custom-control'),\n $productLinks = $carousel.find('.js-desktop-custom-carousel-product-link');\n\n $controls.removeClass('active').first().addClass('active');\n $productLinks.attr('tabindex', '-1').first().attr('tabindex', '0');\n\n // stop slide transition\n document.body.style.setProperty('--customIndex' + carouselIndex, 0);\n });\n }\n }\n ]);\n}\n"],"names":["kidsInit","kidsAnimationsInit","kidsMobileCarouselsInit","kidsDesktopCustomTiggersInit","prevTopScroll","$kidsAnimation1","$","kidsAnimation1Offset","$kidsAnimation1Bottom","kidsAnimation1BottomOffset","$kidsAnimation2","kidsAnimation2Offset","$kidsAnchors","window","addEventListener","currentTopScroll","currentScroll","vbqUtils","breakpoint","is","pageYOffset","innerHeight","length","offset","top","document","body","style","setProperty","hasClass","addClass","removeClass","on","e","type","keyCode","preventDefault","$control","this","$target","attr","cache","$html","animate","scrollTop","set","media","getMediaQuery","enter","$kidsMobileLifestyleCarousels","$allKidsMobileLifestyleControls","event","slick","currentSlide","nextSlide","next","find","filter","slidesToShow","dots","arrows","infinite","each","first","$controls","$carousel","$nav","parent","prev","data","$kidsDesktopCustomCarousels","$kidsDesktopCustomControls","carouselIndex","customBgHeight","height","customProductHeight","outerHeight","index","$groupControls","$productLinks","$this"],"mappings":"AAAA,aAUA,SAASA,WAELC,mBAAmB,EAGnBC,wBAAwB,EAGxBC,6BAA6B,CACjC,CAGA,SAASF,qBACL,IAAIG,EAAgB,EAChBC,EAAkBC,EAAE,sBAAsB,EAC1CC,EAAuB,EACvBC,EAAwBF,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