I am using jQuery Address plug-in to make tabs in jQuery user interface tabs and compatible with last button. It works great.
However, I was wondering if it is possible to provide the same βdeep linkβ for sub tabs? For example, I have the following:
<div id="tabs">
<ul class="links">
<li><a href="#one">main tab one</a></li>
<li><a href="#two">main tab two</a></li>
<li><a href="#three">main tab three</a></li>
<li><a href="#four">main tab four</a></li>
</ul>
<div id="one"> Main tab one content </div>
<div id="two">
Main tab two content
<div id="nested">
<ul>
<li><a href="#nestedone">nested tab one</a></li>
<li><a href="#nestedtwo">nested tab two</a></li>
<li><a href="#nestedthree">nested tab three</a></li>
</ul>
<div id="nestedone"> nested tab one </div>
<div id="nestedtwo"> nested tab two </div>
<div id="nestedthree"> nested tab three </div>
</div>
</div>
<div id="three"> Main tab three content </div>
<div id="fout"> Main tab four content </div>
</div>
<script>
$(document).ready(function(){
var $tabs = $("#tabs").tabs().addClass('ui-tabs-vertical ui-helper-clearfix');
$("#tabs li").removeClass('ui-corner-top').addClass('ui-corner-left');
var $nested = $("#nested").tabs().addClass('ui-tabs-hz');
$("#nested ul").removeClass('ui-tabs-nav');
$.address.change(function(event){
$("#tabs").tabs( "select" , window.location.hash ) ;
})
$("#tabs").bind("tabsselect", function(event, ui) {
window.location.hash = ui.tab.hash;
})
});
</script>
Everything works fine for the main (external tabs):
- The href link in the tab is placed in the url as it is correct.
- external tabs obey browser buttons back and forth
- external tabs are available for bookmarks
However, I can't seem to have the same type of functionality for inner tabs.
, "" , , $(this) ( ). JavaScript , , () .
, JavaScript , , , () . , , , .
$("#tabs").bind("tabsselect", function(event, ui) {
if ($(ui.tab).closest('div').attr('id') !== "nested") {
window.location.hash = ui.tab.hash;
}
})
, - . ?
!