Reputation: 319
I need to do a link to go to a second level of tabs ( for example , direct acces to the tabs ""direct acces 1 ( in my jsfindle""" )
For the first level , I know I need to do that:
http://aaa.com/index.php#tabs-1
But , how can I do for my second level of tabs ? I try http://aaa.com/index.php#tabs-1#tabs2-1 but its not working.... Is it possible to do this with a link or I need to use some jquery ? Thx !
My jsfiddle http://jsfiddle.net/a234j/
Upvotes: 2
Views: 768
Reputation: 12730
You need to do some custom logic. Often hash routes look something like this:
aaa.com/index.php/#/tabs-1/tabs-2
Then, when you do your location.hash
you need to split it:
var hashPath = location.hash.split('/'); //skip the first element, it'll be '#'.
var firstLevel = hashPath[1];
var secondLevel = hashPath[2];
Oh, and I don't think the jQuery tabs plugin has native support for this, so you'll have to manually tell it which tab you want active.
Here's a sample of how to manually switch a tab: http://jqueryui.com/demos/tabs/#...select_a_tab_from_a_text_link_instead_of_clicking_a_tab_itself
Upvotes: 2