1(function ($) { 2 'use strict' 3 4 function generalFunctions() { 5 // Start Marquee 6 $('.marquee').each(function () { 7 var $this = $(this); // Store the current .marquee 8 for(var i = 0; i < 1; i++) { 9 var $cloneOfGroup = $this.find('.marquee__group:first').clone(); // Clone the first .marquee__group 10 // Add aria-hidden to all elements in the clone 11 $cloneOfGroup.find('*').attr('aria-hidden', 'true'); 12 // Append the clone to the current .marquee 13 $this.append($cloneOfGroup); 14 } 15 }); 16 $('.marquee .marquee__group').each(function () { 17 var $this = $(this); // Store the current .marquee__group 18 for(var i = 0; i < 1; i++) { 19 var $cloneOfText = $this.contents().clone().attr('aria-hidden', 'true'); // Clone the text and add aria-hidden 20 // Append the cloned text to the current .marquee__group 21 $this.append($cloneOfText); 22 } 23 }); 24 25 // Filters Panel 26 // Initially hide the filters-panel 27 $(".filters-panel").css({ 28 'right': '-100%', 29 'position': 'fixed' 30 }); 31 // Open the filters-panel 32 $(".product-filter-button").off('click.filterPanel').on('click.filterPanel', function() { 33 $(".filters-panel").animate({ 34 right: '0' 35 }); 36 }); 37 // Close the filters-panel 38 $(".product-filter-close").off('click.filterPanel').on('click.filterPanel', function() { 39 $(".filters-panel").animate({ 40 right: '-100%' 41 }); 42 }); 43 } 44 45 /* Animate On Scroll --------------------- */ 46 function animateScroll() { 47 // Get all elements that have a class containing 'animate__' 48 var elements = $('[class*=animate__]'); 49 50 // Initially set animation-play-state to paused for all elements 51 elements.css('animation-play-state', 'paused'); 52 53 var delay = 0; // Initialize delay 54 var prevEntry = null; // Keep track of the previous entry 55 56 var observer = new IntersectionObserver(function(entries) { 57 entries.forEach(function(entry) { 58 var $el = $(entry.target); 59 60 if (entry.isIntersecting) { 61 // If the current entry is not immediately after the previous one, reset the delay 62 if (prevEntry && $el.prev()[0] !== prevEntry.target) { 63 delay = 0; 64 } 65 66 // Element is visible, add class, apply delay, and set animation-play-state to running 67 $el.addClass('animate__animated') 68 .css({ 69 'animation-delay': delay + 's', 70 'animation-play-state': 'running' 71 }); 72 73 // Unobserve the element so animation doesn't repeat 74 observer.unobserve(entry.target); 75 76 // Increase delay 77 delay += 0.25; 78 79 // Update the previous entry 80 prevEntry = entry; 81 } 82 }); 83 }, { 84 threshold: 0.05 // Adjust as needed 85 }); 86 87 // Observe all elements 88 elements.each(function() { 89 observer.observe(this); 90 }); 91 } 92 93 /* Header Position --------------------- */ 94 function headerSetup() { 95 // Resize Spacer Block 96 $('.site-header + .wp-block-spacer, .site-header + .wp-block-group.woocommerce > .wp-block-spacer:first-child').css({'height':($(".header-wrapper.position-fixed").outerHeight() + 48 + 'px')}); 97 98 // Sticky Position 99 $('.entry-content .position-sticky, .woocommerce-page .wc-block-components-sidebar').css({'top':($(".header-wrapper.position-fixed").outerHeight() + 48 + 'px')}); 100 101 // Check For Image Banners 102 if ($('.page-template-template-blank .site-main > .entry-content > .alignfull:first-child').hasClass('obb-hero') || 103 $('.page-template-template-blank .site-main > .entry-content > .alignfull:first-child').hasClass('obb-slideshow') || 104 $('.page-template-template-blank .site-main > .entry-content > .alignfull:first-child').hasClass('wp-block-cover') || 105 $('.page-template-template-blank .site-main > .entry-content > .alignfull:first-child').hasClass('wp-block-image') || 106 $('.site-main > .alignfull:first-child').hasClass('site-banner') || 107 $('.site-main > .alignfull:first-child').hasClass('wp-block-cover')) { 108 $('.site-header .header-wrapper.position-fixed').addClass('is-transparent') 109 } 110 if ($('.header-wrapper').hasClass('position-fixed')) { 111 $('.header-wrapper').attr('data-position', 'position-fixed') 112 } 113 if ($('.header-wrapper').hasClass('position-absolute')) { 114 $('.header-wrapper').attr('data-position', 'position-absolute') 115 } 116 if ($(this).scrollTop() > 80) { 117 $('.is-transparent').addClass('scrolling') 118 } else { 119 $('.is-transparent').removeClass('scrolling') 120 } 121 if ($('.site-logo-alt')[0]) { 122 $('.site-logo-wrapper').addClass('logo-alt-exists') 123 } 124 } 125 126 /* Navigation Overlay Submenus --------------------- */ 127 // Core binds aria-expanded to the overlay state, so its own toggle cannot 128 // collapse a submenu while the overlay is open. The theme adds its own. 129 function overlaySubmenuSetup() { 130 var items = document.querySelectorAll('.wp-block-navigation__overlay-container li.has-child') 131 if (!items.length) { 132 return 133 } 134
135 items.forEach(function (item, index) { 136 var link = item.querySelector(':scope > .wp-block-navigation-item__content') 137 var submenu = item.querySelector(':scope > .wp-block-navigation__submenu-container') 138 if (!link || !submenu) { 139 return 140 } 141 142 link.id = link.id || 'stax-nav-link-' + index 143 submenu.id = submenu.id || 'stax-nav-submenu-' + index 144 145 var toggle = document.createElement('button') 146 toggle.type = 'button' 147 toggle.className = 'stax-submenu-toggle' 148 toggle.setAttribute('aria-expanded', 'false') 149 toggle.setAttribute('aria-controls', submenu.id) 150 toggle.setAttribute('aria-labelledby', link.id) 151 toggle.innerHTML = '<i class="fas fa-chevron-down" aria-hidden="true"></i>' 152 link.insertAdjacentElement('afterend', toggle) 153 154 toggle.addEventListener('click', function () { 155 var isOpen = item.classList.toggle('is-submenu-open') 156 toggle.setAttribute('aria-expanded', isOpen ? 'true' : 'false') 157 }) 158 }) 159 160 // Start collapsed again the next time the overlay is opened. 161 document.querySelectorAll('.wp-block-navigation__responsive-container-open').forEach(function (opener) { 162 opener.addEventListener('click', function () { 163 document.querySelectorAll('.wp-block-navigation__overlay-container .is-submenu-open').forEach(function (item) { 164 item.classList.remove('is-submenu-open') 165 item.querySelector(':scope > .stax-submenu-toggle').setAttribute('aria-expanded', 'false') 166 }) 167 }) 168 }) 169 } 170 171 // Main initialization 172 $(document) 173 .ready(function() { 174 generalFunctions(); 175 animateScroll(); 176 overlaySubmenuSetup(); 177 }); 178 179 $(window) 180 .on('load', function() { 181 headerSetup(); 182 }) 183 .on('scroll', headerSetup) 184 .on('resize', headerSetup); 185})(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.