Direct Link to jQuery UI tabs
I've got a set of jQuery UI tabs link so:
<div id="tabs">
<ul>
<li><a href="#some_div">Overview</a></li>
<li><a href="/somelink.html">Some Link</a></li>
<li><a href="/anotherlink.html">Another Link</a></li>
<li><a href="#">Other</a></li>
</ul>
</div>
What I'm trying to achieve is a direct link to a specific tab. So for instance if the tabs were in /tabs.html I'd want to be able to access the anotherlink.html directly but through tabs.html (essentially a 开发者_如何转开发link that will open tabs.html but with the anotherlink tab selected). I could obviously create the functionality by doing tabs.html#anotherlink and then checking the url and selecting the correct tab. I just wanted to make sure there was no obvious built in way to do this in jQuery UI.
I couldn't find anything in the documentation so any help would be appreciated!
You can you use the .load()
function if there is a link clicked.
And you can also fetch the value of href and don't forget preventdefault() so the links don't work as normal links.
Save the href value of the clicked link in the tab's div and then do something like .load('...html/#variable')
The accepted solution (mentioned in a comment below) is here.
精彩评论