Re: Hi, is there a way to only enable sticky headers for my product pages?

Solved

Hi, is there a way to only enable sticky headers for my product pages?

Mdb_Gioto
Excursionist
49 0 17

Hi, is there a way to enable sticky headers only for my product pages?

 

I just want a normal header for the homepage of my website pages so it is easy to read. Thank you!

P.S. I am using symmetry theme theme

 

this is my link store: https://vomeroitaly.com/

 

thanks

Accepted Solution (1)
kevinkarma55
Shopify Partner
101 11 11

This is an accepted solution.

Good job! Ok so here is the part you need to change:

basically all the code that is inside .section-header {...} need to be put inside like following:

{% if template.name != "index" %} 
 .section-header {
   position: -webkit-sticky;
   position: sticky;
}
{% endif %}

 

so you final <style> code looks like this:

<style data-shopify="">
  .logo img {
    width: 270px;
  }
  .logo-area__middle--logo-image {
    max-width: 270px;
  }
  @media (max-width: 767.98px) {
    .logo img {
      width: 180px;
    }
  }
{% if template.name != "index" %} 
  .section-header {
    position: -webkit-sticky;
    position: sticky;
  }
{% endif %}
</style>

and SAVE

what I did above is that your section header sticky effect only works if page is not homepage 

Please remember to Like & Mark Solution to the post if it helped you.
Thanks !
If you'd like to support me, you can Buy Me a Coffee
Need help with anything related to Frontend?
Checkout kevinkarma.me

View solution in original post

Replies 8 (8)

Guleria
Shopify Partner
4104 803 1155

Hello @Mdb_Gioto ,

 

Yes possible but need customization.

If you can just find the classes which are used to make the header sticky.
Once you find it make them conditional

like this

{%- if template == "product" -%}

class will use 

{%- endif -%}

 

If you need help with code part you can drop me an email.

You can find the email in the signature below.

Thanks

- Custom themes, UI/UX design, ongoing maintenance & support.
- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder

kevinkarma55
Shopify Partner
101 11 11

Hi,

Do you remember where you add the following code?: 

kevinkarma55_0-1729882223511.png

 

Please remember to Like & Mark Solution to the post if it helped you.
Thanks !
If you'd like to support me, you can Buy Me a Coffee
Need help with anything related to Frontend?
Checkout kevinkarma.me
Mdb_Gioto
Excursionist
49 0 17

nope, is it possible to find it?

kevinkarma55
Shopify Partner
101 11 11

try finding it in theme.liquid

Please remember to Like & Mark Solution to the post if it helped you.
Thanks !
If you'd like to support me, you can Buy Me a Coffee
Need help with anything related to Frontend?
Checkout kevinkarma.me
Mdb_Gioto
Excursionist
49 0 17

I don't see it

kevinkarma55
Shopify Partner
101 11 11

how about header.liquid ? 

Please remember to Like & Mark Solution to the post if it helped you.
Thanks !
If you'd like to support me, you can Buy Me a Coffee
Need help with anything related to Frontend?
Checkout kevinkarma.me
Mdb_Gioto
Excursionist
49 0 17

yes, found it! thanks!

 What now?

kevinkarma55
Shopify Partner
101 11 11

This is an accepted solution.

Good job! Ok so here is the part you need to change:

basically all the code that is inside .section-header {...} need to be put inside like following:

{% if template.name != "index" %} 
 .section-header {
   position: -webkit-sticky;
   position: sticky;
}
{% endif %}

 

so you final <style> code looks like this:

<style data-shopify="">
  .logo img {
    width: 270px;
  }
  .logo-area__middle--logo-image {
    max-width: 270px;
  }
  @media (max-width: 767.98px) {
    .logo img {
      width: 180px;
    }
  }
{% if template.name != "index" %} 
  .section-header {
    position: -webkit-sticky;
    position: sticky;
  }
{% endif %}
</style>

and SAVE

what I did above is that your section header sticky effect only works if page is not homepage 

Please remember to Like & Mark Solution to the post if it helped you.
Thanks !
If you'd like to support me, you can Buy Me a Coffee
Need help with anything related to Frontend?
Checkout kevinkarma.me