whereisscott Posted January 3, 2023 Share Posted January 3, 2023 Hi all, I'm starting a new website and one of the elements the client is asking for is a small section above the navigation bar for an image and some text (please see the attached). Seems simple to do, but I haven't been able to land a solution yet. Has anyone achieved something similar? Thanks, -Scott Link to comment
Beyondspace Posted January 4, 2023 Share Posted January 4, 2023 (edited) 3 hours ago, whereisscott said: Hi all, I'm starting a new website and one of the elements the client is asking for is a small section above the navigation bar for an image and some text (please see the attached). Seems simple to do, but I haven't been able to land a solution yet. Has anyone achieved something similar? Thanks, -Scott Squarespace have a standard feature - announcement bar which appears on the top of your website. If you need to add a custom layout like your images attached, we can add it on the footer and use some javascript code to move it above the header. It is noticed that javascript is only available on Business Plan or above ones. Edited January 4, 2023 by Beyondspace BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox, video lightbox and much more) 🗓️ Delivery Date Picker (Squarespace Date picker form field) 💫 Gallery block 7.1 workaround 🥳 No-code customisations for Squarespace (+100 Spark plugin customisations) 🥳 Freemium Squarespace Widget Templates (+1000 Elfsight Templates) 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
whereisscott Posted January 4, 2023 Author Share Posted January 4, 2023 Thank you for your reply. The announcement bar doesn't hold graphics, so this wouldn't be a suitable solution for what we need to do here. I'm curious - couldn't moving a section to the top also be done with CSS? Link to comment
tuanphan Posted January 7, 2023 Share Posted January 7, 2023 It's possible with CSS, but it depends Black nav will stick to top on scroll or not? This for one page or all pages? With CSS the solution might be to create that section as the first section, then use CSS position to move the position of the two sections. 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
Solution whereisscott Posted January 10, 2023 Author Solution Share Posted January 10, 2023 Hi @tuanphan Yes, I was able to do this - here's the code. It would only work for a single page since this targets only the section that would be on the homepage right now, but it's good to know how I'd do this. (I've since created a workaround that includes the text the client wanted to be on the navigation bar). Here's the code, though: #header { position: absolute; top: 340px; /* This value determines the distance from the top of the page */ left: 0; } section[data-section-id="NUM] { position: absolute; bottom: 190px; /* This value determines the distance from the top of the page */ left: 0; } tuanphan 1 Link to comment
Dovely2023 Posted February 3, 2023 Share Posted February 3, 2023 Hi @tuanphan this was super helpful for us, but I noticed when I am previewing the site in the header it looks perfect but when I go to actually preview the link in a private browser the home page is all messed up. Do I need to adjust the css in some way? I'd appreciate your help! Screenshots below for reference. https://penguin-toucan-s42t.squarespace.com/ Password: DoveLove2023! Link to comment
tuanphan Posted February 8, 2023 Share Posted February 8, 2023 On 2/4/2023 at 5:20 AM, Dovely2023 said: Hi @tuanphan this was super helpful for us, but I noticed when I am previewing the site in the header it looks perfect but when I go to actually preview the link in a private browser the home page is all messed up. Do I need to adjust the css in some way? I'd appreciate your help! Screenshots below for reference. https://penguin-toucan-s42t.squarespace.com/ Password: DoveLove2023! Which exact steps did you do to achieve this? We can troubleshoot easier 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
Dovely2023 Posted February 8, 2023 Share Posted February 8, 2023 5 hours ago, tuanphan said: Which exact steps did you do to achieve this? We can troubleshoot easier Hi @tuanphan I added the code below to the home page header code injection. Let me know if you have any other questions. Thank you! <style> #header { position: absolute; top: 800px; left: 0; } section[data-section-id="63d2bf7a62c5995280861b4e"] { position: absolute; bottom: 50px; left: 0; } #siteWrapper.site-wrapper .sqs-button-element--primary { border-color: #E8927C; } </style> <style> @media screen and (max-width: 641px) { #header { position: absolute; top: 650px; left: 0; } section[data-section-id="63d2bf7a62c5995280861b4e"] { position: absolute; bottom: 50px; left: 0; } #siteWrapper.site-wrapper .sqs-button-element--primary { border-color: #E8927C; } } </style> Link to comment
Dovely2023 Posted February 9, 2023 Share Posted February 9, 2023 Hi @tuanphan just following up on this. Let me know if you have any other questions. Thank you! Link to comment
Dovely2023 Posted February 9, 2023 Share Posted February 9, 2023 On 2/3/2023 at 4:20 PM, Dovely2023 said: Hi @tuanphan this was super helpful for us, but I noticed when I am previewing the site in the header it looks perfect but when I go to actually preview the link in a private browser the home page is all messed up. Do I need to adjust the css in some way? I'd appreciate your help! Screenshots below for reference. https://penguin-toucan-s42t.squarespace.com/ Password: DoveLove2023! Hi @whereisscott thank you for providing the code. It worked perfectly for our site. The only thing we noticed though is that the changes took in the editor preview mode, but when we view the site in a private window outside the editor the hero section looks completely off. You can see above for screenshots. Would you be able to help us with this? Our site URL is https://penguin-toucan-s42t.squarespace.com/ and the password is DoveLove2023! Thank you for advice you have. Link to comment
Dovely2023 Posted February 9, 2023 Share Posted February 9, 2023 8 minutes ago, Dovely2023 said: Hi @whereisscott thank you for providing the code. It worked perfectly for our site. The only thing we noticed though is that the changes took in the editor preview mode, but when we view the site in a private window outside the editor the hero section looks completely off. You can see above for screenshots. Would you be able to help us with this? Our site URL is https://penguin-toucan-s42t.squarespace.com/ and the password is DoveLove2023! Thank you for advice you have. Hi @whereisscott we actually found a better solution for the hero image above the navigation but now the entire section disappears when we preview the site outside the squarespace editor preview. Have you seen this before? Any ideas on how to fix? We would appreciate your help! Link to comment
Dovely2023 Posted February 9, 2023 Share Posted February 9, 2023 4 hours ago, Dovely2023 said: Hi @whereisscott we actually found a better solution for the hero image above the navigation but now the entire section disappears when we preview the site outside the squarespace editor preview. Have you seen this before? Any ideas on how to fix? We would appreciate your help! I actually figured this out. Thank you! Link to comment
Despina Posted August 4, 2023 Share Posted August 4, 2023 Hello there, I put this code in the homapage code injection and when I go to edit the page the edit bar is out of the section and I can't get to it. When I remove the code the problem is gone. Is there any solution? <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://d1j8mu9lowy9zf.cloudfront.net/twcsl/0.2.2/twcsl.js"></script> <script> document.addEventListener("DOMContentLoaded",function() { const header = document.getElementById('header'); const firstSection = document.querySelector('.page-section:first-child'); firstSection.after(header); }); </script> <style> @media screen and (min-width: 768px) { #header { position: sticky; top: 0; display: none; } main .page-section:first-child + #header { display: block; } main .page-section:first-child { min-height: calc(100vh - 93px)!important; } } </style> Link to comment
tuanphan Posted August 4, 2023 Share Posted August 4, 2023 1 hour ago, Despina said: Hello there, I put this code in the homapage code injection and when I go to edit the page the edit bar is out of the section and I can't get to it. When I remove the code the problem is gone. Is there any solution? <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://d1j8mu9lowy9zf.cloudfront.net/twcsl/0.2.2/twcsl.js"></script> <script> document.addEventListener("DOMContentLoaded",function() { const header = document.getElementById('header'); const firstSection = document.querySelector('.page-section:first-child'); firstSection.after(header); }); </script> <style> @media screen and (min-width: 768px) { #header { position: sticky; top: 0; display: none; } main .page-section:first-child + #header { display: block; } main .page-section:first-child { min-height: calc(100vh - 93px)!important; } } </style> Suppose your site is despina.squarespace.com You can access despina.squarespace.com/config/safe It will disable code in Edit Mode, then you can edit everything in edit mode easier 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
Despina Posted August 4, 2023 Share Posted August 4, 2023 Τhanks, now it works for editing but when Ι exit the edit mode the code still doesn't work. Link to comment
Despina Posted August 4, 2023 Share Posted August 4, 2023 OK I found it. "Enable scripts" . Οne more question please. When the site is live, my client will be able to do the same for possible editing? Link to comment
tuanphan Posted August 6, 2023 Share Posted August 6, 2023 On 8/4/2023 at 7:16 PM, Despina said: OK I found it. "Enable scripts" . Οne more question please. When the site is live, my client will be able to do the same for possible editing? Yes. That link always work, for both trial & paid 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
PRHG Posted September 29, 2023 Share Posted September 29, 2023 On 2/8/2023 at 6:44 AM, Dovely2023 said: Hi @tuanphan I added the code below to the home page header code injection. Let me know if you have any other questions. Thank you! <style> #header { position: absolute; top: 800px; left: 0; } section[data-section-id="63d2bf7a62c5995280861b4e"] { position: absolute; bottom: 50px; left: 0; } #siteWrapper.site-wrapper .sqs-button-element--primary { border-color: #E8927C; } </style> <style> @media screen and (max-width: 641px) { #header { position: absolute; top: 650px; left: 0; } section[data-section-id="63d2bf7a62c5995280861b4e"] { position: absolute; bottom: 50px; left: 0; } #siteWrapper.site-wrapper .sqs-button-element--primary { border-color: #E8927C; } } </style> Hi, I tried using this. But doesn't seem to work on my end. Any help or tips? Link to comment
tuanphan Posted October 3, 2023 Share Posted October 3, 2023 On 9/30/2023 at 4:02 AM, PRHG said: Hi, I tried using this. But doesn't seem to work on my end. Any help or tips? What is your site url? 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
PRHG Posted October 3, 2023 Share Posted October 3, 2023 10 hours ago, tuanphan said: What is your site url? www.lawhg.net. Thank you! Link to comment
tuanphan Posted October 7, 2023 Share Posted October 7, 2023 On 10/4/2023 at 2:29 AM, PRHG said: www.lawhg.net. Thank you! Above code for SS 7.1, your site is 7.0 Use this code to Website Tools (under Not Linked) > Code Injection > Footer <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script> <script> $(document).ready(function(){ $('body.homepage header#header').insertAfter('.banner-thumbnail-wrapper.has-description'); }); </script> <style> body.homepage header#header { position: sticky !important; position: -webkit-sticky !important; top: 0 !important; background-color: white !important; } </style> 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
collgrimes Posted October 11, 2023 Share Posted October 11, 2023 I used this code and it works but the section above the navigation is HUGE on desktop - how can I fix the size? <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://d1j8mu9lowy9zf.cloudfront.net/twcsl/0.2.2/twcsl.js"></script> <script> document.addEventListener("DOMContentLoaded",function() { const header = document.getElementById('header'); const firstSection = document.querySelector('.page-section:first-child'); firstSection.after(header); }); </script> <style> @media screen and (min-width: 768px) { #header { position: sticky; top: 0; display: none; } main .page-section:first-child + #header { display: block; } main .page-section:first-child { min-height: calc(100vh - 93px)!important; } } </style> Link to comment
creedon Posted October 12, 2023 Share Posted October 12, 2023 4 hours ago, collgrimes said: how can I fix the size? Please post the URL for a page on your site where we can see your issue. A link to the backend of the your site won’t work for us, i.e. a url that contains /config/. Please set up a site-wide password, if your site is not public and you've not already done so. Post the password here. Adding a site-wide password does not allow anyone to alter your site. It only allows those with the password to see your site. Please read the site-wide password and how to share a link documentation to understand how they work. We can then take a look at your issue. You may find How to post a forum question post useful. Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects. Link to comment
PRHG Posted October 18, 2023 Share Posted October 18, 2023 On 10/7/2023 at 2:02 AM, tuanphan said: Above code for SS 7.1, your site is 7.0 Use this code to Website Tools (under Not Linked) > Code Injection > Footer <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script> <script> $(document).ready(function(){ $('body.homepage header#header').insertAfter('.banner-thumbnail-wrapper.has-description'); }); </script> <style> body.homepage header#header { position: sticky !important; position: -webkit-sticky !important; top: 0 !important; background-color: white !important; } </style> Hello! Sorry for the late reply. You are very helpful! Unfortunately, this is what it looked like. Recording 2023-10-18 093925.mp4 Link to comment
tuanphan Posted October 21, 2023 Share Posted October 21, 2023 On 10/18/2023 at 11:39 PM, PRHG said: Hello! Sorry for the late reply. You are very helpful! Unfortunately, this is what it looked like. Recording 2023-10-18 093925.mp4 You mean you want same video, or the code run and same as video and that's not what you want, so what is your desired result? 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