jQuery 如何使用 Twitter Bootstrap 框架淡入和淡出标签?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8915602/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I fade tabs in & out with the Twitter Bootstrap framework?
提问by Travis Northcutt
jQuery UI has the option to initialize tabs with the tabs set to fade in/out, like so:
jQuery UI 可以选择使用设置为淡入/淡出的选项卡来初始化选项卡,如下所示:
$(".selector").tabs({ fx: { opacity: 'toggle' } });
Is something similar possible with the Twitter Bootstrap framework tabs?
Twitter Bootstrap 框架选项卡是否有类似的可能?
采纳答案by Sinetheta
回答by baxang
Both for Bootstrap 2 and 3, you can simply give your .tab-pane
elements a fade
class with bootstrap-transition.js
loaded. No need to write a single line of your own JavaScript code at all.
对于 Bootstrap 2 和 3,您可以简单地为您的.tab-pane
元素提供一个加载的fade
类bootstrap-transition.js
。根本不需要编写一行您自己的 JavaScript 代码。
<div class="tab-content">
<div class="tab-pane fade in active" id="home">...</div>
<div class="tab-pane fade" id="profile">...</div>
<div class="tab-pane fade" id="messages">...</div>
<div class="tab-pane fade" id="settings">...</div>
</div>
Code sample from the official Twitter Bootstrap documentation.
来自官方 Twitter Bootstrap 文档的代码示例。