hello!
Wondering if someone can help me im wanting to make my header transparent and then turn to the solid colour when i scroll.
Is this possible?
hello!
Wondering if someone can help me im wanting to make my header transparent and then turn to the solid colour when i scroll.
Is this possible?
Hi @Andia
First of all have to add a class for header on scroll.
Then have to write the css accordingly.
this can be done usning the custom css and js code.
Hello @Andia ,
You can try to follow these steps:
Go to Online Store → Themes → Actions → Edit code
Go to theme.scss.liquid file → Add this following code at the bottom of page
.site-header {
background-color: rgba(0, 0, 0, 0);
transition: background-color 0.3s ease;
}
Add this Javascript code
$(document).ready(function() {
var header = $(".site-header");
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll > 100) {
header.css("background-color", "your-solid-color-hex-code");
} else {
header.css("background-color", "rgba(0, 0, 0, 0)");
}
});
});
Save and preview
Hope this can help.
Ali Reviews team.
where does the javascript go??
off sitewide
July sale — 45% off at checkout, applied automatically. Valid for 60 minutes. One per customer.
Offer ends in