ArieJxD Posted March 5 Share Posted March 5 Hey all, I'm trying to move a section above my site header (see image) but don't seem to be able to with any code I could find on other forums, Is anyone able to help out? Link to comment
tuanphan Posted March 8 Share Posted March 8 You can use this code to Page Header Code Injection. The code will move First Section above Header <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script> <script> jQuery(document).ready(function($){ $('article>section:first-child').insertBefore('header#header'); }) </script> <style> header#header { position: sticky !important; transform: Unset !important; } div#siteWrapper>section { padding: 0px !important; z-index: 999999 !important; } </style> If you can't make code work, you can share link to page in screenshot, we can check 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
BlancDesignStudio Posted June 5 Share Posted June 5 Hey @tuanphan Thanks for posting this code, I've found it helpful. Is there a way to get the first section to move above the header on the home page only? Thanks in advance for your help! Link to comment
tuanphan Posted June 6 Share Posted June 6 On 6/5/2024 at 7:13 AM, BlancDesignStudio said: Hey @tuanphan Thanks for posting this code, I've found it helpful. Is there a way to get the first section to move above the header on the home page only? Thanks in advance for your help! Use this code <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script> <script> jQuery(document).ready(function($){ $('body.homepage article>section:first-child').insertBefore('body.homepage header#header'); }) </script> <style> body.homepage header#header { position: sticky !important; transform: Unset !important; } body.homepage div#siteWrapper>section { padding: 0px !important; z-index: 999999 !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
BlancDesignStudio Posted June 16 Share Posted June 16 @tuanphan I've just noticed on mobile view my menu navigation is showing behind the top section, do you happen to know if there is a way to bring this forward? I've attached a screenshot for reference. URL: https://jaguar-red-txe9.squarespace.com/ PASSWORD: IslaKate Link to comment
Lesum Posted June 16 Share Posted June 16 @BlancDesignStudio The code @tuanphan shared, affected both desktop and mobile layouts, which may not be a good user experience on mobile devices. Here's the updated version that will only affect the desktop version: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script> <script> jQuery(document).ready(function($){ $('body.homepage article>section:first-child').insertBefore('body.homepage header#header'); }) </script> <style> @media screen and (min-width: 768px) { body.homepage header#header { position: sticky !important; transform: Unset !important; } body.homepage div#siteWrapper>section { padding: 0px !important; z-index: 999999 !important; } } </style> tuanphan 1 If my comments were useful, please like or mark my solution as answer so others can scroll to it quickly. Sam Web Developer & Digital Designer ☕ Did you find my contribution helpful? Buy me a coffee? Link to comment
BlancDesignStudio Posted June 17 Share Posted June 17 @Lesum Thank you! Worked perfectly! 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