Need a help-Debut theme- Sticky fixed bar on just the home page

Solved
Excursionist
32 0 7

Hello, 

I recently made the bar of the main menu sticked and fixed on I roll down.

The problem is I just want it to be fixed in my home page, not in all other pages.

Is there any way to do that? if so , please tell me how.

MY WEBSITE URL: https://presets-market.com

 

 

0 Likes
Highlighted
Shopify Partner
635 129 151

Hello Lisa,

Wrap your css or class name which you used to make header fixed in this condition 

{% if template == 'index' %}
// Your code here
{% endif %}
Want to modify or custom changes on store hire me.
My Email: guleriathakur43@gmail.com
Skype: navrocks1
If helpful then please Like and Accept Solution.
If you are happy and want to donate small Click here (Its my paypal)
1 Like
Highlighted

Success.

Hello @Lilas-addas,

If you dont want sticky header in another pages then

Go to theme.scss file

Search your code which you applied for sticky header

.site-header {
	position: fixed;
	z-index: 1000;
	left: 0;
	right: 0;
	-webkit-box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.1);
	-moz-box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.1);
	-ms-box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.1);
	-o-box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.1);
	box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.1);
}

and replace it with below code

.template-index .site-header {
	position: fixed;
	z-index: 1000;
	left: 0;
	right: 0;
	-webkit-box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.1);
	-moz-box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.1);
	-ms-box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.1);
	-o-box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.1);
	box-shadow: 0px 2px 4px 0px rgba(0,0,0,0.1);
}

So it will affects only on homepage not on another pages

 

Want to modify or incorporate custom changes on store, Hire us.
If helpful then please Like and Accept Solution .
Email: pallavi@oscprofessionals.com
Skype : oscprofessionals-87
Free Review and advice for sale on store | Shopify Private App | Custom Theme Development | Custom Modifications In To Shopify Theme | SEO & Digital Marketing | Site Speed Optimization | Performance Site Audit
2 Likes
Highlighted
Excursionist
32 0 7

@oscprofessional Thank you so much! It works very well. 

 

1 Like