带有Bootstrap的活动按钮3 [英] Active Buttons with Bootstrap 3
本文介绍了带有Bootstrap的活动按钮3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的导航栏中,我希望我的按钮变为活动(阴影),当我点击他们。现在,我只能永久地使他们活跃或不活跃,但不知道如何改变,一旦我点击他们。我使用新的Bootstrap(3.0)。
In my navbar, I want my buttons to become active (shaded) when I click on them. Right now, I can only permanently make them active or non-active but don't know how to have it change once I click on them. I'm using the new Bootstrap (3.0).
例如:
非活动
<li><%= link_to "Contact", contact_path %></li>
活动
<li class="active"><%= link_to "About", about_path %></li>
我想要它是活动/非活动取决于是否选择当前页面。
I want it to be active/non-active depending on whether the current page is selected or not.
使用jQuery的示例
解决方案
推荐答案
>
Example with jQuery:
$('ul li').click( function() {
$(this).addClass('active').siblings().removeClass('active');
});
DEMO
或更多引导:
Bootstrap 3 DEMO
这篇关于带有Bootstrap的活动按钮3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文