从链接中调出特定的navtab [英] Calling out a specific navtab from a link

查看:83
本文介绍了从链接中调出特定的navtab的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我尝试使用特定的表ID来链接链接,这样当链接打开时,调用的特定表id将是打开的活动选项卡(即www.gohome.com/asset.html#profile)。但无论我做什么,活动标签仍然停滞不前,特别是调用标签id似乎什么都不做。我开始认为没有我实现某种脚本就无法完成。但我不擅长编码。任何形式的帮助都会很棒。谢谢你提前。



我尝试了什么:



so i try to href links with specific table IDs so that when the link is opened the specific table id called will be the active tab opened( ie. www.gohome.com/asset.html#profile). but no matter what i do the active tab still remains stagnant and specifically calling out tab id's dont seem to do anything. im starting to think it cant be done without me implementing some sort of script. but im not that good at coding. any form of help will be great. thanks n advance.

What I have tried:

<div class="tab-content">
 <div class="tab-pane active" id="profile">
  <div class="single-service">
   <h3>me</h3>
  </div>
 </div>

 <div class="tab-pane " id="messages">
  <div class="single-service">
   <h2>you</h2>
  </div> 
 </div>
</div>


<ul class="nav nav-tabs">
 <li><a href="#profile">me </a></li> <li><a href="#messages">you</a></li>              </ul>

推荐答案

这样的事情应该是这样的工作,假设您正在使用标准的Bootstrap 3选项卡 [ ^ ]:

Something like this should work, assuming you're using the standard Bootstrap 3 tabs[^]:
<script>


(function(){
var target = location.hash;
if(target){
(function () { var target = location.hash; if (target) {


(a [data-toggle ='tab'] [href ='+ target +'])。tab(show );
}
});
< / script>
("a[data-toggle='tab'][href='" + target + "']").tab("show"); } }); </script>


这篇关于从链接中调出特定的navtab的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆