Needs review
Project:
Tabs (jQuery UI tabs)
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
11 Nov 2010 at 06:16 UTC
Updated:
13 Mar 2011 at 14:19 UTC
It would be nice to have an anchor that is contained in a tab activate that tab. My specific use case is having a tab in position 2 for comments. After a user submits the comment form the fragment '#comment-$cid' is added to the URL. Ideally the tab that contains this fragment should be activated.
I have attached a patch that is working for me to accomplish this but I'm not 100% convinced it's a be all end all solution. Either way, wanted to get a discussion going on this.
| Comment | File | Size | Author |
|---|---|---|---|
| tabs.patch | 1.14 KB | elliotttf |
Comments
Comment #1
tvu007 commentedTurn on the attribute history, set it to true. Then link using an achor... href="#tab3" it will go to tab3 and activate it as the current active tab. This assumes you have the anchors actually referenced in the
Comment #2
stealthtech1 commentedtvu007 can you explain what you meant by turning on the history attribute?
Comment #3
klonos...really useful feature. Thanx ;)
Comment #4
elliotttf commented@tvu007, that's not exactly what this patch accomplishes. What this is attempting to do is satisfy the case where your tab contains an anchor. This change will activate the containing tab.
So to expand on your example, setting the anchor to #foo in this list would activate Tab 2