Can please someone help me?
Here .header-line after scroll has an additional class of .header-line .active but css can't see it and doesn't change the background-color. You can see my css and there .header-line .active is with background-color property. Why is my background still transparent?
CSS:
.header-line {
width: 100%;
height: 60px;
background-color: rgba(255,255,255,0.00);
}
.header-line .active {
background-color: white;
}
header:
<div class="header-line">header</div>
Javascript:
$(function() {
$(window).on("scroll", function() {
if($(window).scrollTop() > 50) {
$(".header-line").addClass("active");
} else {
//remove the background property so it comes transparent again (defined in your css)
$(".header-line").removeClass("active");
}
});
});