-3
我想使用一個包括PHP文件與Bootstrap的導航欄,但我嘗試刪除導航欄中的類「活動」,並在點擊導航按鈕時添加新的「活動」類。Bootstrap導航欄刪除活動
的jquery.js
$(document).ready(function() {
$(".nav li").click(function() {
e.stopImmediatePropagation();
$(".nav li").removeClass('active');
$(this).addClass('active');
});
}
navbar.php(它被包含在主頁)
<nav role="navigation" class="navbar navbar-inverse">
<div class="container" id="navfluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navigationbar">
<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" href="#">Gestor de Férias</a>
</div>
<div class="collapse navbar-collapse" id="navigationbar">
<ul class="nav navbar-nav ">
<li class="active"><a href="/gestor/">Inicio</a></li>
<li><a href="form.html">Informações</a></li>
<li><a href="propostas.php">Propostas</a></li>
<li><a href="carousel.html">Contacte-nos</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<!-- <li>
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="srch-term" id="srch-term">
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search"></button>
</div>
</div>
</form>
</li> -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-user" aria-hidden="true"></span> Perfil <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Editar informações</a></li>
<li><a href="#">Mudar de grupo</a></li>
<li><a href="#">Alterar Password</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Sair</a></li>
</ul>
</li>
</ul>
</div>
</div>
畢竟它並不在我的項目工作,但它的jsfiddle工作。當我點擊'Propostas'時,該按鈕突出顯示一秒鐘,然後返回'Inicio'。 Conta.php:'<?php include'navbarConta.php'?> //代碼'它在navbarConta.php中我有這個引導程序的導航欄。我不知道這是否有所不同。 – Pedro