使用 Jquery-ui 选项卡,使用父选项卡集和子选项卡集,如何在选项卡“表兄弟”之间链接?
给定一个父选项卡集,每个选项卡都有多个子选项卡集。如何创建在“表兄弟”内容之间链接的 ?这是我到目前为止所尝试过的,我并不认为它是正确的!我尝试从选项卡 id=#A.1 跳转到表弟 #E.2 的每个链接都没有成功。
脚本:
<script> $(document).ready(function(event){
var tabs = $("#parentTabSet, #childSet1, #childSet2").tabs();
//here's what i've tried so far:
$(".interTabLink").click(function(event){
//this gets the `<ul><li><a href="#someId">tab user wants to see</a></li></ul>`
var ulLink =$(".anytabset").find("[href='"+$(this).attr("href")+"']");
//filter the 'var tabs' array to only have the tabset we want.
tabs.filter("#"+ulLink.closest("div").attr("id")).tabs("select", $(this).attr("href"));
});
});
</script>
html:
<body>
<div id="parentTabSet" class="anyTabSet">
<ul>
<li><a href="#A">parent A</a></li>
<li><a href="#B">parent B</a></li>
<li><a href="#C">parent C</a></li>
<li><a href="#D">parent D</a></li>
<li><a href="#E">parent E</a></li>
</ul>
<div id="A">
<div id="childset1" class="anyTabSet">
<ul>
<li><a href="#A.1">foo</a></li>
<li><a href="#A.2">bar</a></li>
</ul>
<div id="#A.1"><p>insert your latin here</p></div>
<div id="#A.2">
<!--- this will link to cousin #E.2, with parent tab E --->
<a href="#E.2" class="interTabLink">more information here</a>
</div>
</div>
</div>
<div id="B">
<p>insert your latin here</p>
</div>
<div id="C">
<p>insert your latin here</p>
</div>
<div id="D">
<p>insert your latin here</p>
</div>
<div id="E">
<div id="childset2" class="anyTabSet">
<ul>
<li><a href="#E.1">foo</a></li>
<li><a href="#E.2">bar</a></li>
</ul>
<div id="#E.1">stuff</div>
<div id="#E.2">here</div>
</div>
</div>
</div>
</body>
Given one parent tab set, with each tab having multiple child tab sets. How do i create a <a href="#??"></a>
that links between 'cousin' content? This is what I've tried so far, I do not claim it to be right! Every link i've tried to jump from tab id=#A.1 to cousin #E.2 has not succeeded.
script:
<script> $(document).ready(function(event){
var tabs = $("#parentTabSet, #childSet1, #childSet2").tabs();
//here's what i've tried so far:
$(".interTabLink").click(function(event){
//this gets the `<ul><li><a href="#someId">tab user wants to see</a></li></ul>`
var ulLink =$(".anytabset").find("[href='"+$(this).attr("href")+"']");
//filter the 'var tabs' array to only have the tabset we want.
tabs.filter("#"+ulLink.closest("div").attr("id")).tabs("select", $(this).attr("href"));
});
});
</script>
html:
<body>
<div id="parentTabSet" class="anyTabSet">
<ul>
<li><a href="#A">parent A</a></li>
<li><a href="#B">parent B</a></li>
<li><a href="#C">parent C</a></li>
<li><a href="#D">parent D</a></li>
<li><a href="#E">parent E</a></li>
</ul>
<div id="A">
<div id="childset1" class="anyTabSet">
<ul>
<li><a href="#A.1">foo</a></li>
<li><a href="#A.2">bar</a></li>
</ul>
<div id="#A.1"><p>insert your latin here</p></div>
<div id="#A.2">
<!--- this will link to cousin #E.2, with parent tab E --->
<a href="#E.2" class="interTabLink">more information here</a>
</div>
</div>
</div>
<div id="B">
<p>insert your latin here</p>
</div>
<div id="C">
<p>insert your latin here</p>
</div>
<div id="D">
<p>insert your latin here</p>
</div>
<div id="E">
<div id="childset2" class="anyTabSet">
<ul>
<li><a href="#E.1">foo</a></li>
<li><a href="#E.2">bar</a></li>
</ul>
<div id="#E.1">stuff</div>
<div id="#E.2">here</div>
</div>
</div>
</div>
</body>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
像这样的东西会起作用:
工作示例: http://jsfiddle.net/petersendidit/uz7d5/
Something like this would work:
Working example: http://jsfiddle.net/petersendidit/uz7d5/