semigrownkid Posted March 15 Share Posted March 15 Here's my website: https://uxplaybook.org/ How do I fixed the Parity Deals banner below my navigation? Right now its on Top and hides as I scroll. Need some help fixing this under my navigation. Here's the code I used: <!-- Start of Parity Deals Banner --> <script> function debounceCustom(func, timeout =300) { let timer=null; return (...args) => {clearTimeout(timer); timer = setTimeout(() => { func.apply(this, args); }, timeout); }; } function fixHeader() { window.scrollY; const findBanner = document.getElementsByClassName('parity-banner-has-logo'); const findMenu = document.getElementsByClassName('header-announcement-bar-wrapper'); if (findBanner.length > 0 && findMenu.length > 0) { const banner = findBanner[0]; const menu = findMenu[0]; banner.style.zIndex = 100; if (window.scrollY === 0) { menu.style.marginTop = banner.offsetHeight.toString() + 'px'; } else { menu.style.marginTop = '0px'; } } } document.addEventListener('scroll', debounceCustom(fixHeader), { passive: true }); fixHeader(); </script> <!-- End of Parity Deals Banner --> Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment