#white1{
background-color: white;
}
#mainNav {
background-color: #ffffff00;
/*background-color: #212529;*/
}
jquery
$(document).ready(function(){
$(".navbar-toggler").click(function(){
if ($("#mainNav").css("background-color") != $("#white1").css("background-color")){
$("#mainNav").css("background-color", "white");
}else{
$("#mainNav").css("background-color", "#ffffff00");
}
});
});
html
<nav class="navbar navbar-expand-lg navbar-dark fixed-top " id="mainNav">
<div class="container">
<img src="http://www.astrixpt.co.il/wp-content/uploads/2019/03/logo_last1.png" class="img-responsive navbar-brand js-scroll-trigger">
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
list
<i class="fas fa-bars"></i>
</button>
i want the standard nav bar to be transparent, whenever i click on "list" button the navbar the list opens and background turns into white and when to click on button "list" again to close the list i want the navbar to turn transparent again
but the problem is when i press on the buttons once it goes from transparent to white and no matter how many i press again it stays white