我想要的是,当我点击配置文件选项卡时,我获得绿色css(class =“btn btn-large btn-block btn-success disabled”)启用超过配置文件并禁用主页选项卡按钮/我怎么能这样做?
<!-- Nav tabs -->
<ul class="nav nav-tabs">
<li><a href="#home" class="btn btn-large btn-block btn-success disabled" data-toggle="tab" >Home</a></li>
<li><a href="#profile" data-toggle="tab">Profile</a></li>
<li><a href="#messages" data-toggle="tab">Messages</a></li>
<li><a href="#settings" data-toggle="tab">Settings</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="home">Write Here Tab Home Part</div>
<div class="tab-pane" id="profile">Write Here Tab Profile Part</div>
<div class="tab-pane" id="messages">Write Here Tab Messages Part</div>
<div class="tab-pane" id="settings">Write Here Tab Settings Part</div>
</div>
答案 0 :(得分:0)
使用css无法做到这一点,所以在这种情况下我会使用jQuery:
$('.nav li a').click(function() {
$(this).addClass('btn-success').siblings('a').removeClass('btn-success');
}
答案 1 :(得分:0)
试试这个:
$("li").click(
function(){
$("[class='btn btn-large btn-block btn-success disabled']").removeClass("btn btn-large btn-block btn-success disabled");
$(this).children("a").addClass("btn btn-large btn-block btn-success disabled");
}
);