I’ve read a couple of posts where they resolution to have a sticky/fixed header included using a file named theme.scss.liquid where you then implement a code to make the header sticky throughout the website. Is this possible to do without using a theme.scss.liquid file? I do not have that asset because it seems that it is no longer supported by shopify. PLEASE HELP!
Hello @ausheabeauty ,
Step 1:
- Go to Online Store->Theme->Edit code
- Asset-> theme.css-> paste bellow code in bottom of file
.stickHeader{
position: fixed;
z-index:1000;
left:0;
right:0;
-webkit-box-shadow:0px 2px 4px 0px rgba(0,0,0,.1);
-moz-box-shadow:0px 2px 4px 0px rgba(0,0,0,.1);
-ms-box-shadow:0px 2px 4px 0px rgba(0,0,0,.1);
-o-box-shadow:0px 2px 4px 0px rgba(0,0,0,.1);
box-shadow:0px 2px 4px 0px rgba(0,0,0,.1);
background-color: {{ settings.color_body_bg }};
}
Step 2:
- Go to Online Store->Theme->Edit code
- Asset->theme.js paste bellow code in bottom of file
$(window).scroll(function() {
var scroll = $(window).scrollTop();
//>=, not <=
if (scroll >= 10) {
$("#shopify-section-header").addClass("stickHeader");
} else {
$("#shopify-section-header").removeClass("stickHeader");
}
});
Thanks
You can go to theme.css file, it’s same as theme.scss.liquid.
Hope it clear to you.
Unfortunately, this didn’t work for me. Can I please get assistance.
Unfortunately, this didn’t work for me. Can I please get assistance.
