3
How do I change the color of a menu by scrolling the page?
I’m doing like this
$(function() {
$(window).on("scroll", function() {
if($(window).scrollTop() > 100) {
$(".sidebar-wrapper").addClass("teste2");
} else {
$(".sidebar-wrapper").removeClass("teste2");
}
});
});
And it’s not working, someone can help?
#sidebar-wrapper {
z-index: 1000;
position: fixed;
left: 250px;
width: 0;
height: 100%;
margin-left: -250px;
overflow-x: hidden;
background: #195884;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.teste2{
background: #FFF;
}
what are the CSS definitions for
.sidebar-wrapper
and.teste2
? (add to question)– Pedro Sanção