I need to have two level tab navigation.
Basically like this:
Tab1 Tab2 Tab3
TabA TabB TabC
When user clicks for example Tab2 he then can choose again from 2nd level tabs (TabA, 开发者_JAVA技巧TabB etc).
I can make the first level ok but I can't make the 2nd level. How can i put it in the first level tabs.
Just nest the second set of tabs within the first set inside your html like so:
<div id="tabs">
<ul>
<li><a href="#tab-1"><span>One</span></a></li>
<li><a href="#tab-2"><span>Two</span></a></li>
<li><a href="#tab-3"><span>Three</span></a></li>
</ul>
<div id="tab-1">
<p>First tab is active by default.</p>
<p>Second tab contains nested tabs.</p>
</div>
<div id="tab-2">
<!-- Nested Tabs! -->
<ul>
<li><a href="#nested-1"><span>One</span></a></li>
<li><a href="#nested-2"><span>Two</span></a></li>
<li><a href="#nested-3"><span>Three</span></a></li>
</ul>
<div id="nested-1">
Nest tab 1 content: Onerem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy..
</div>
<div id="nested-2">
Nest tab 2 content: Tworem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy..
</div>
<div id="nested-3">
Nest tab 3 content: Threm ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy..
</div>
<!-- End Nested Tabs -->
Regular tab 2 content (optional)
</div>
<div id="tab-3">
<p>Second tab contains multiple tabs.</p>
</div>
</div>
..and initialize them both on document ready like so:
<script>
$(document).ready(function() {
$("#tabs").tabs();
$("#tab-2").tabs();
});
</script>
When in doubt, check out the jQuery tabs api documentation at http://docs.jquery.com/UI/Tabs
精彩评论