Javascript 打开引导选项卡表单外部页面
我在第页有引导选项卡。它工作得很好。我想从外部页面打开此选项卡。有可能吗Javascript 打开引导选项卡表单外部页面,javascript,jquery,angularjs,html,twitter-bootstrap,Javascript,Jquery,Angularjs,Html,Twitter Bootstrap,我在第页有引导选项卡。它工作得很好。我想从外部页面打开此选项卡。有可能吗 <div role="tabpanel"> <ul class="nav nav-tabs" role="tablist"> <li role="presentation" class="active"><a href="#permisions" class="active" aria-controls="permisions"
<div role="tabpanel">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#permisions" class="active" aria-controls="permisions" role="tab" data-toggle="tab">Tab1</a></li>
<li role="presentation"><a href="#roles" aria-controls="roles" role="tab" data-toggle="tab">Tab 2</a></li>
<li role="presentation"><a href="#users" aria-controls="users" role="tab" data-toggle="tab">Tab 3</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane active"id="permisions" >
<div id="exRowTable_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
<div class="tableContainer">
<section class="techtable">
<div class="table-responsive">
Content 1
</div>
</section>
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane" id="roles">
<div id="exRowTable_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
<div class="tableContainer">
<section class="techtable">
<div class="table-responsive">
Content 2
</div>
</section>
</div>
</div>
</div>
<div role="tabpanel" class="tab-pane"id="users">
<div id="exRowTable_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
<div class="tableContainer">
<section class="techtable">
<div class="table-responsive">
Content 3
</div>
</section>
</div>
</div>
</div>
</div>
</div>
内容1
内容2
内容3
我的要求是:从不同页面呼叫标签。
如果无法使用引导,请向我推荐其他选项卡库。首先,您必须从外部页面执行类似操作:
<a href="yourpage.html#users">Click here to see all users</a>
我希望这有帮助。@Yosep是100%正确的。我还想补充一点,如果您想在每个选项卡显示上保持状态,可以将哈希添加到url。这一点很重要,因为用户可能希望获取当前URL并共享当前屏幕,而无需猜测ID是什么。为此,您可以点击
显示的.bs.选项卡
事件添加更新位置.hash
下面是这个问题的一个例子:
$(函数(){
//跳转到选项卡(如果存在)
if(location.hash){
$('a[href='+location.hash+']')。选项卡('show');
}
//将选项卡哈希添加到url以保持状态
$(document.body).on(“show.bs.tab”,函数(e){
location.hash=e.target.hash;
});
});
如果我没弄错的话,是的,这是可能的。我会使用套接字。你是说你想根据点击的内容显示一个特定的选项卡以进入页面吗?分享一些如何实现的东西…你可以使用ng类表达式。请提供管制员的代码和路线示例以帮助您。是的,泰德,我希望您能这么说
var hash = document.location.hash;
if (hash) {
$('.nav-tabs a[href="#' + hash + '"]').tab('show');
}