I am using the Debut theme and have customized my header to be transparent and sticky. I have also made the header change colour when someone hovers over it. I want the background colour of the header to switch to white when the page scrolls.
I have tried adding some javascript to the theme.js file but so far it has not worked for me. I am wondering if I can get some help debugging my code.
My site url is: https://naeem-gifts-co.myshopify.com/ and the password is: mompew
This is the CSS I added:
.site-header .headerscroll {
background-color: white;
}
And here is the javascript:
$(function() {
$(window).on("scroll", function() {
if($(window).scrollTop() > 50) {
$(".site-header").addClass("headerscroll");
} else {
//remove the background property so it comes transparent again (defined in your css)
$(".site-header").removeClass("headerscroll");
}
});
});