I would like the navigation bar to be transparent but when you scroll down the page it changes to color red for example.
<div class="nav">
<div class="container">
<div class="logo">
<a href="#"><img src="RepublicSquare_logo.svg" style="height: 80px;"></a>
</div>
<div class="navMain">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</div>
</div>
Something like this:
http://jsfiddle.net/qrhjdfmd/
var a = $(".nav").offset().top;
$(document).scroll(function(){
if($(this).scrollTop() > a)
{
$('.nav').css({"background":"red"});
} else {
$('.nav').css({"background":"transparent"});
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With