I am not sure if this is possible at the moment, and the testing ive done seems to offer odd results.
I have on one page a section of 4 tabs, inside these tabs are several sections of text that i have each given a unique anchor name.
What i am trying to do is link from another page to say the 4th block of content in tab 3...
the tabs are all working great, and if i link to content sections on the first tab it works great.. its when i want to link to the tabs that arent the first that it gets tricky..
i have tried
<a href="http://example.com#tab-3#content-4" ></a>
but this doesnt work at all
and when i use just
<a href="http://example.com#tab-3"></a>
i have also seen this being implemented - however it seems to have the same functionality as just using the above piece of code regardless of if this is in my jquery call
$(function(){
$('tabs').tabs();
var hash = location.hash;
$('tabs').tabs( "select" , hash );
});
With either of the above 2 options while the third tab is selected i am pushed all the way to the bottom of the page. I assume this is because all the tabs are placed in list items and then jqueryui turns them into tabs.. in effect moving the tab content for number 3 from the bottom back up to the top of the tabs section..
if anyone knows how i could link to the 4th block of content on the 3rd tab i would be extremely greatful.
someone the solution might lie in $_post and $_get data.. but im not sure if thats really the case, and even then im not sure how to implement it with jqueryui
Thank you in advance
Old question, but I ran into this deep-linking jQuery tab need today. I also had to retain the hash on post-backs. Below works to deep-link into jQuery tabs AND retain the hash on post-back by appending the hash to the form's action.
Depending on what server-side scripting language you're using, if any, you could pass the tab you want selected in the url,
$_GET[]
it, then echo it as theselected
option in your call to thetabs();
widget. Then using a nifty function I found in another stack thread, you can get the coordinates of your selected element and scroll to it.e.g. using PHP
Then on your tabs page:
Try this:
As a link use
And the script
try