Jump to content

Excluding code from portfolio subpages

Recommended Posts

Hi,

I have applied a portfolio page which is acting as my home page. On this page I have customised the header to be sticky so that it appears under a video on loading the page and as you scroll down it sticks to the top. This works perfect on the home page but it is the only page that i want it to appear. It doesnt happen on the contact us or about page however at the moment it is appearing on the portfolio subpages which are linked to the home page. Does anyone know how to exclude this style from appearing on the subpages. Below is the code I have currently

 

<style>
@media screen and (min-width: 768px) {
#header {
  position: sticky;
  top: 0;
  display: none;
  z-index: 10000;
}
main .page-section:first-child + #header {
  display: block;
}
main .page-section:first-child {
  min-height: calc(100vh - 93px)!important;
}
}
</style>

Link to comment
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Hi @BryanMinton, instead of placing this code in the header injection, you could put it in the Custom CSS and target it to the page Collection ID, that way it would only affect the homepage.

If you can share your website URL and site wide password if applicable then I can provide you with the full CSS.

Please like and upvote if my comments were useful to you. Thanks!

Zygmunt Spray
Squarespace Website Designer
Contact me: https://squarefortytwo.com/ 
🔌Ghost Squarespace Plugins (Referral link)
Buy me a coffee

Link to comment
1 hour ago, Ziggy said:

Hi @BryanMinton, instead of placing this code in the header injection, you could put it in the Custom CSS and target it to the page Collection ID, that way it would only affect the homepage.

If you can share your website URL and site wide password if applicable then I can provide you with the full CSS.

I have applied it to the home page settings in the pages tab. Is it better to move this to the custom css in design instead?

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.