jQuery 激活具有多个链接的单个选项卡 - 同时在两个选项卡上设置活动类
正如标题所示,我想制作一个选项卡界面,其中有多个链接控制同一选项卡面板。
希望您在查看示例时能明白我的意思: http://jsfiddle.net/kimatg/EtVZW/2/
这里一切正常,这些链接都运行良好,但一个问题是“活动”类(在本例中 .current
)一次只能在一个选项卡选择器容器中工作...
换句话说,我有 2 个标签演示中的菜单(.map
和 .tabnav
);当我点击div.tabnav
中的Region 2时,相应的a
标签获取类.current
,但相应的div.map
中的 a
标记则不然。
如何使两个 div 同时获取 .current
类,而不是在选择另一个选项卡时获取?
哦,顺便说一句,我在示例中使用了 jQuery 工具,但如果需要像 jQuery UI 那样以不同的方式实现它也没关系。
as the title says, I want to make a tab interface where I have multiple links that control the same tab panel.
Hopefully you'll get what I mean when you look at the example:
http://jsfiddle.net/kimatg/EtVZW/2/
Here everything works just fine and the links all work well, but one problem is that the "active" class (in this case .current
) will only work in one tab-selector-containers at a time...
In other words, I have 2 tab menus (.map
and .tabnav
) in the demo; when I click Region 2 in div.tabnav
, the corresponding a
tag gets class .current
, but the corresponding a
tag in div.map
doesn't.
How can I make both divs get .current
classes at the same time and not when another tab is selected?
Oh and by the way I used jQuery Tools in the example, but It's fine if there's a need to implement it a different way like jQuery UI.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

我不熟悉 jQuery 工具,所以我使用了 UI。
这是小提琴: http://jsfiddle.net/jomanlk/XwpDK/4/
基本上,我使用索引来突出显示正确的链接
I'm not familiar with jQuery Tools so I used UI.
Here's the fiddle : http://jsfiddle.net/jomanlk/XwpDK/4/
Basically, I used the index to highlight the proper link