Guest Posted October 29, 2019 Share Posted October 29, 2019 how to keep navigation bar while im scrolling, I'm using the bedford template wht is a css code Link to comment
SnazzyView Posted October 29, 2019 Share Posted October 29, 2019 I've linked to a blog post by @dualarrowmarketing which details how to make the navigation bar fixed on scroll. https://insidethesquare.co/squarespace-tutorials/fixed-header-drop-shadow-squarespace-css Link to comment
moeezali Posted October 30, 2019 Share Posted October 30, 2019 Hi, Here's the solution. Navigate to code Injection section of the site: Settings > Advanced > Code Injection Paste this code: <script> window.onscroll = () => { var scrollPos = window.pageYOffset var header = document.getElementById('#header'); if (scrollPos > 600) { header.classList.add('bgColor'); } else { header.classList.remove('bgColor'); } } </script> <style> header#header { position: fixed !important; } header#header.bgColor { background-color: black; } </style> Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.