whoiscooper Posted October 6, 2020 Share Posted October 6, 2020 Site URL: http://www.whoiscooper.com/ I'd like my navigation to disappear when scrolling down, and reappear when scrolling up. Beyondspace 1 Link to comment
tuanphan Posted October 7, 2020 Share Posted October 7, 2020 You need jQuery to do this. Do you use Personal or Business Plan? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
whoiscooper Posted January 1, 2021 Author Share Posted January 1, 2021 business plan Beyondspace 1 Link to comment
Beyondspace Posted January 1, 2021 Share Posted January 1, 2021 (edited) On 1/1/2021 at 8:44 AM, whoiscooper said: business plan Add this to Settings->Advanced->Code Injection->Footer <style> header.Header, .Mobile-bar { transition: transform 0.4s; } .scroll-down header.Header, .scroll-down .Mobile-bar { transform: translate3d(0, -100%, 0); } </style> <script> document.addEventListener('DOMContentLoaded', function() { const body = document.body; const scrollUp = "scroll-up"; const scrollDown = "scroll-down"; let lastScroll = 0; window.addEventListener("scroll", () => { const currentScroll = window.pageYOffset; if (currentScroll <= 0) { body.classList.remove(scrollUp); return; } if (currentScroll > lastScroll && !body.classList.contains(scrollDown)) { // down body.classList.remove(scrollUp); body.classList.add(scrollDown); } else if (currentScroll < lastScroll && body.classList.contains(scrollDown)) { // up body.classList.remove(scrollDown); body.classList.add(scrollUp); } lastScroll = currentScroll; }); }); </script> Edited January 2, 2021 by bangank36 tuanphan 1 BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - Lightbox captions only mode) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace 🚀 Learn how to rank new pages on Google in 48 hours! If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
whoiscooper Posted January 1, 2021 Author Share Posted January 1, 2021 10 hours ago, bangank36 said: Add this to Settings->Advanced->Code Injection->Footer <style> header, .Mobile-bar { transition: transform 0.4s; } .shrink header, .shrink .Mobile-bar { transform: translate3d(0, -100%, 0); } </style> <script> document.addEventListener('DOMContentLoaded', function() { var body = document.body; var scrollDown = "shrink"; let scrollOffset = 50; window.addEventListener("scroll", () => { const currentScroll = window.pageYOffset; if (currentScroll <= scrollOffset) { body.classList.remove(scrollDown); return; } if (currentScroll > scrollOffset) { // down body.classList.add(scrollDown); } }); }); </script> This is so close to what I'm looking for. Is it possible to have the navigation reveal itself as soon as I start scrolling up? For example, if I'm at the footer of a long page, and I start scrolling up, can the navigation show up before reaching the top of the page? Thank you for your help. Beyondspace 1 Link to comment
Beyondspace Posted January 2, 2021 Share Posted January 2, 2021 11 hours ago, whoiscooper said: This is so close to what I'm looking for. Is it possible to have the navigation reveal itself as soon as I start scrolling up? For example, if I'm at the footer of a long page, and I start scrolling up, can the navigation show up before reaching the top of the page? Thank you for your help. I just updated the code whoiscooper 1 BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - Lightbox captions only mode) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace 🚀 Learn how to rank new pages on Google in 48 hours! If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
whoiscooper Posted January 2, 2021 Author Share Posted January 2, 2021 (edited) 10 hours ago, bangank36 said: I just updated the code Thank you. But now the "Quick Subscribe" newsletter heading in the footer is behaving weirdly when I reach the bottom of the page. Almost like it want's to recede like the navigation... Such is the world of code, I presume. Easy to fix? Edited January 2, 2021 by whoiscooper Beyondspace 1 Link to comment
Beyondspace Posted January 2, 2021 Share Posted January 2, 2021 46 minutes ago, whoiscooper said: Thank you. But now the "Quick Subscribe" newsletter heading in the footer is behaving weirdly when I reach the bottom of the page. Almost like it want's to recede like the navigation... Such is the world of code, I presume. Easy to fix? That interesting, i should recheck BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - Lightbox captions only mode) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace 🚀 Learn how to rank new pages on Google in 48 hours! If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
Beyondspace Posted January 2, 2021 Share Posted January 2, 2021 2 hours ago, whoiscooper said: Thank you. But now the "Quick Subscribe" newsletter heading in the footer is behaving weirdly when I reach the bottom of the page. Almost like it want's to recede like the navigation... Such is the world of code, I presume. Easy to fix? Updated snippet whoiscooper 1 BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - Lightbox captions only mode) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace 🚀 Learn how to rank new pages on Google in 48 hours! If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
whoiscooper Posted January 2, 2021 Author Share Posted January 2, 2021 11 minutes ago, bangank36 said: Updated snippet Yes! Thank you so much. You rock. Beyondspace 1 Link to comment
Beyondspace Posted January 2, 2021 Share Posted January 2, 2021 5 minutes ago, whoiscooper said: Yes! Thank you so much. You rock. Your site is well done, is that yours or client? whoiscooper 1 BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - Lightbox captions only mode) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace 🚀 Learn how to rank new pages on Google in 48 hours! If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
whoiscooper Posted January 2, 2021 Author Share Posted January 2, 2021 2 minutes ago, bangank36 said: Your site is well done, is that yours or client? Thanks! It's mine. Still making little tweaks. It's a work in progress. Beyondspace 1 Link to comment
Beyondspace Posted January 2, 2021 Share Posted January 2, 2021 10 minutes ago, whoiscooper said: Thanks! It's mine. Still making little tweaks. It's a work in progress. Kindly provide the template name if you don't mind, I think this solution can help others with the same template as well creedon 1 BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - Lightbox captions only mode) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace 🚀 Learn how to rank new pages on Google in 48 hours! If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
whoiscooper Posted January 2, 2021 Author Share Posted January 2, 2021 7 minutes ago, bangank36 said: Kindly provide the template name if you don't mind, I think this solution can help others with the same template as well I believe it's Vow. Under help section, it reads: Version 7.0- Brine family (L & M template). Hope that helps. Beyondspace 1 Link to comment
Beyondspace Posted January 2, 2021 Share Posted January 2, 2021 13 minutes ago, whoiscooper said: I believe it's Vow. Under help section, it reads: Version 7.0- Brine family (L & M template). Hope that helps. Thank you, have a great day BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - Lightbox captions only mode) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace 🚀 Learn how to rank new pages on Google in 48 hours! If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
GregLassale Posted April 26, 2021 Share Posted April 26, 2021 On 12/31/2020 at 10:51 PM, bangank36 said: <style> header.Header, .Mobile-bar { transition: transform 0.4s; } .scroll-down header.Header, .scroll-down .Mobile-bar { transform: translate3d(0, -100%, 0); } </style> <script> document.addEventListener('DOMContentLoaded', function() { const body = document.body; const scrollUp = "scroll-up"; const scrollDown = "scroll-down"; let lastScroll = 0; window.addEventListener("scroll", () => { const currentScroll = window.pageYOffset; if (currentScroll <= 0) { body.classList.remove(scrollUp); return; } if (currentScroll > lastScroll && !body.classList.contains(scrollDown)) { // down body.classList.remove(scrollUp); body.classList.add(scrollDown); } else if (currentScroll < lastScroll && body.classList.contains(scrollDown)) { // up body.classList.remove(scrollDown); body.classList.add(scrollUp); } lastScroll = currentScroll; }); }); </script> Hi @bangank36 I also use a 7.0 Brine family template (Sofia), but the code above doesn't work for me. Any idea? Site URL is https://gregorylassale.com Thanks in advance. Beyondspace 1 Link to comment
Beyondspace Posted April 27, 2021 Share Posted April 27, 2021 22 hours ago, GregLassale said: Hi @bangank36 I also use a 7.0 Brine family template (Sofia), but the code above doesn't work for me. Any idea? Site URL is https://gregorylassale.com Thanks in advance. Did you follow all steps, it working fine when I try BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - Lightbox captions only mode) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace 🚀 Learn how to rank new pages on Google in 48 hours! If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
GregLassale Posted April 27, 2021 Share Posted April 27, 2021 Got it. I had removed my fixed nav CSS thinking it would conflict with your code, but it looks like it's the other way around and your script needs a fixed header in order to work? All good now. Thanks! Beyondspace 1 Link to comment
Beyondspace Posted April 27, 2021 Share Posted April 27, 2021 44 minutes ago, GregLassale said: Got it. I had removed my fixed nav CSS thinking it would conflict with your code, but it looks like it's the other way around and your script needs a fixed header in order to work? All good now. Thanks! the script based on default template GregLassale 1 BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - Lightbox captions only mode) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace 🚀 Learn how to rank new pages on Google in 48 hours! If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you! Link to comment
GregLassale Posted April 28, 2021 Share Posted April 28, 2021 @bangank36 Could your script be modified so that the navigation is revealed if the person stops scrolling (or if they click a link that takes them down the page)? Link to comment
GregLassale Posted May 1, 2021 Share Posted May 1, 2021 Following up on this. Is there a way to modify the code below so that the navigation bar slides out after a short delay whenever the scrolling stops? <style> header.Header, .Mobile-bar { transition: transform 0.4s; } .scroll-down header.Header, .scroll-down .Mobile-bar { transform: translate3d(0, -100%, 0); } </style> <script> document.addEventListener('DOMContentLoaded', function() { const body = document.body; const scrollUp = "scroll-up"; const scrollDown = "scroll-down"; let lastScroll = 0; window.addEventListener("scroll", () => { const currentScroll = window.pageYOffset; if (currentScroll <= 0) { body.classList.remove(scrollUp); return; } if (currentScroll > lastScroll && !body.classList.contains(scrollDown)) { // down body.classList.remove(scrollUp); body.classList.add(scrollDown); } else if (currentScroll < lastScroll && body.classList.contains(scrollDown)) { // up body.classList.remove(scrollDown); body.classList.add(scrollUp); } lastScroll = currentScroll; }); }); </script> Link to comment
AnnaCartier Posted May 17, 2021 Share Posted May 17, 2021 On 1/1/2021 at 5:51 AM, bangank36 said: Add this to Settings->Advanced->Code Injection->Footer <style> header.Header, .Mobile-bar { transition: transform 0.4s; } .scroll-down header.Header, .scroll-down .Mobile-bar { transform: translate3d(0, -100%, 0); } </style> <script> document.addEventListener('DOMContentLoaded', function() { const body = document.body; const scrollUp = "scroll-up"; const scrollDown = "scroll-down"; let lastScroll = 0; window.addEventListener("scroll", () => { const currentScroll = window.pageYOffset; if (currentScroll <= 0) { body.classList.remove(scrollUp); return; } if (currentScroll > lastScroll && !body.classList.contains(scrollDown)) { // down body.classList.remove(scrollUp); body.classList.add(scrollDown); } else if (currentScroll < lastScroll && body.classList.contains(scrollDown)) { // up body.classList.remove(scrollDown); body.classList.add(scrollUp); } lastScroll = currentScroll; }); }); </script> Hello @bangank36, I've been wanting to apply this on our site (https://www.artinis.com) but got no luck using the script above. I'm using the Fulton template. Would you kindly take a look? Thanks before. Link to comment
tuanphan Posted May 18, 2021 Share Posted May 18, 2021 @anitaartinis try this new code <style> header#header { transition: transform 0.4s; } .scroll-down header#header { transform: translate3d(0, -100%, 0); } </style> <script> document.addEventListener('DOMContentLoaded', function() { const body = document.body; const scrollUp = "scroll-up"; const scrollDown = "scroll-down"; let lastScroll = 0; window.addEventListener("scroll", () => { const currentScroll = window.pageYOffset; if (currentScroll <= 0) { body.classList.remove(scrollUp); return; } if (currentScroll > lastScroll && !body.classList.contains(scrollDown)) { // down body.classList.remove(scrollUp); body.classList.add(scrollDown); } else if (currentScroll < lastScroll && body.classList.contains(scrollDown)) { // up body.classList.remove(scrollDown); body.classList.add(scrollUp); } lastScroll = currentScroll; }); }); </script> Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
AnnaCartier Posted May 18, 2021 Share Posted May 18, 2021 @tuanphan Thank you for your help! I tried your code but it also doesn't make any effect, unfortunately. Link to comment
tuanphan Posted May 19, 2021 Share Posted May 19, 2021 14 hours ago, anitaartinis said: @tuanphan Thank you for your help! I tried your code but it also doesn't make any effect, unfortunately. try edit this Quote transform: translate3d(0, -100%, 0); to this Quote transform: translate3d(0, -100%, 0) !important; Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) 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