Jump to content

Pre Homepage Scrollable Header

Recommended Posts

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

Link to comment
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.