BareCreative Posted November 19, 2022 Share Posted November 19, 2022 (edited) I was wondering if anyone can help, I have found and used this code from @tuanphan which was incredible, however I am looking to put the navigation bar below the 'second section' of the homepage (while keeping the dynamic and re-appear on scroll back properties) Is this possible? this is the code found from @tuanphan <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> Edited November 19, 2022 by BareCreative Link to comment
BareCreative Posted November 19, 2022 Author Share Posted November 19, 2022 I have tried using this change to the code - (replacing 'first-child to 'nth-child(2) Which has worked but has caused the section section to have strange spacing and also lost the dynamic movement within the header navigation <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:nth-child(2)'); firstSection.after(header); }); </script> <style> @media screen and (min-width: 768px) { #header { position: sticky; top: 0; display: none; } main .page-section:nth-child(2) + #header { display: block; } main .page-section:nth-child(2) { min-height: calc(100vh - 93px)!important; } } </style> Link to comment
BareCreative Posted November 19, 2022 Author Share Posted November 19, 2022 managed to solve this through - (code below) - anyone see any issues with this? ALSO Could anyone help with being able to enable 'scroll back' as everytime i enable it through the pre-header settings - it causes the code to break? <style> @media screen and (min-width: 768px) { #header { position: sticky; top: 0; display: none; z-index: 10000; } main .page-section:nth-child(2) + #header { display: block; } </style> <script> document.addEventListener("DOMContentLoaded",function() { const header = document.getElementById('header'); const firstSection = document.querySelector('.page-section:nth-child(2)'); firstSection.after(header); }); </script> Link to comment
tuanphan Posted November 23, 2022 Share Posted November 23, 2022 Do you still need help? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care 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