I am looking to change the color of my navbar upon scrolling. When the navbar is at the top, the background should be transparent. Thank you to everyone for the attention and I apologize for my poor English!
/* Navbar Color */
.navbar-default .navbar-toggle .icon-bar {
background-color: #fff;
box-shadow: 1px 1px #000;
}
.navbar-toggle {
background-color: transparent;
border: none;
}
.navbar-toggle:hover {
background-color: transparent! important;
}
.navbar-toggle:focus {
background-color: transparent! important;
}
.navbar-default {
background-color: transparent;
border-color: transparent;
}
.navbar-default .navbar-nav>li>a {
color: #FFF;
text-shadow: 1px 1px #000;
}
.navbar-default .navbar-nav>li>a:focus,
.navbar-default .navbar-nav>li>a:hover {
color: red;
}
.navbar-default .navbar-nav>.active>a,
.navbar-default .navbar-nav>.active>a:focus,
.navbar-default .navbar-nav>.active>a:hover {
background-color: yellow;
}
.navbar-default .navbar-nav>.open>a,
.navbar-default .navbar-nav>.open>a:focus,
.navbar-default .navbar-nav>.open>a:hover {
background-color: blue;
}
.dropdown-menu>li>a {
color: green;
}
.dropdown-menu>li>a:hover {
background-color: brown;
color: violet;
}
.navbar-brand>li>a:hover {
color: white;
}
@media only screen and (max-width: 766px) {
.collapsing,
.in {
background: #fff;
}
.collapsing ul li a,
.in ul li a {
color: #fff!important;
float: left;
}
.collapsing ul li a:hover,
.in ul li a:hover {
color: #fff !important;
background-color: #E1332D;
}
}
<!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand page-scroll" href="#page-top" style="color: white;">LUCA DELCONTE</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<!-- Hidden li included to remove active class from about link when scrolled up past about section -->
<li class="hidden">
<a class="page-scroll" href="#page-top"></a>
</li>
<li>
<a class="page-scroll" href="#about"><i class="fa fa-smile-o" aria-hidden="true"></i>
About</a>
</li>
<li>
<a class="page-scroll" href="#services"><i class="fa fa-diamond" aria-hidden="true"></i>
Design</a>
</li>
<li>
<a class="page-scroll" href="#work"><i class="fa fa-lightbulb-o" aria-hidden="true"></i>
Work</a>
</li>
<li>
<a class="page-scroll" href="#contact"><i class="fa fa-envelope" aria-hidden="true"></i>
Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>