1
我想選擇摺疊的Bootstrap導航欄中的導航鏈接。我希望移動版導航元素的顏色有所不同。我試圖用navbarCollapse.in
這樣做,但這不起作用。摺疊菜單中的Boostrap導航元素選擇器
window.onload = $('.navbar-wrapper a').css('color', 'white');
window.onload = $('#navbarCollapse.in a').css('color', '#36454F');
我的導航欄看起來如下:
<nav role="navigation" class="nav navbar navbar-fixed-top navbar-default navbar-wrapper white-link">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="index.html" class="navbar-brand"><div class="logo logo-color-white"></div>Brand</a>
</div>
<!-- Collection of nav links and other content for toggling -->
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav navbar-right">
<li class="approach-li"><a href="approach.html" style="color: black;"><i class="fa fa-rocket"> Approach</i></a></li>
<li class="services-li"><a href="services.html" style="color: black;"><i class="fa fa-tags"> Services</i></a></li>
<li class="about-li"><a href="about.html" style="color: black;"><i class="fa fa-building-o"> About</i></a></li>
<li class="qa-li"><a href="qa.html" style="color: black;"><i class="fa fa-question-circle"> Q&A</i></a></li>
<li class="navbarpadding">
<form action="contact.html">
<button class="btn navbar-btn">Contact us</button>
</form>
</li>
</ul>
</div>
</div>
</nav>