I'm trying to make JS code to change the navbar background to transparent on scroll but for some reason it's not working and I've tried console log and it's working so can you help me out to find what's wrong?
<script type="text/javascript">
$(document).scroll(function(){
if($(this).scrollTop() > 1)
{
$(".navbar-fixed-top").css("background-color", "white !important");
console.log("Done");
} else if ($(this).scrollTop() <= 1) {
$(".navbar-fixed-top").css("background-color", "transparent !important");
console.log("Back");
}
});
</script>