sean_hos Posted August 6, 2022 Posted August 6, 2022 Site URL: https://www.seanhdesigns.com Hello there!  I'm in the middle of deciding on a new portfolio website and would love to create a pre-homepage header similar to this website here:https://arentpyke.com/ Would anyone know how to go about this? any help is appreciated 🙂 I would also like to ask how this would effect the template I pick since they scroll past the nav bar and then that stays in place afterwards.  Cheers! Sean
tuanphan Posted August 10, 2022 Posted August 10, 2022 You want Header under first section (on homepage only) On scroll, header will be sticky to top (homepage only) Is this right? Add this code to Homepage Header <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>  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!)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment