I am currently setting my header that adding a class that changes the background to gradient.
Here is my code on adding and removing the class using jQuery.
$(document).ready(function(){
$(window).scroll(function(){
if($(this).scrollTop() > 100){
$('header').addClass('gradientHeader');
}else{
$('header').removeClass('gradientHeader');
}
});
});
and for CSS
.gradientHeader{
background: linear-gradient(-45deg, #57cfb0, #2ab5d3);
transition: background 0.3s;
}
my the adding and removing class is working but the transition on background isn't triggering..
working with .css with jquery is triggering the transition but it is with background-color
and i want the specific color using background: linear-gradient(-45deg, #57cfb0, #2ab5d3);
$('gradientHeader').css("background-color", "red");
and workaround doing this?