jQuery 选项卡。从某个位置打开某个选项卡。可能的?

标签 jquery hyperlink jquery-tabs

我在我的网站上使用 jQuery 选项卡,并且在其中一个选项卡上有一篇文章,在另一个选项卡上有评论。 是否可以从文章选项卡链接到评论选项卡并从使用“名称”属性定义的特定位置打开它?

最佳答案

jQuery UI 1.8.4 release添加了您可能感兴趣的功能:

TABS
The tabs plugin has been updated to allow accessing tabs by href in addition to index. The enable, disable, select, load, and remove methods all accept the href of a tab.

例如,您想要的可能如下所示:

$("#tabs").tabs("select", "#comments");

对于滚动,您可以只执行 window.location 或使用其他类似 the scrollTo() plugin 的内容。以获得更多实用性。

例如:

$("#tabs").tabs("select", "#comments");
$("#comments").scrollTo("#comment-1234");

You can give it a try here .

关于jQuery 选项卡。从某个位置打开某个选项卡。可能的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3202734/

相关文章:

templates - 使用 CakePHP 为自定义模板链接创建分页

jquery - 隐藏 div 上的 Google Map API V3(jquery-ui 选项卡)

javascript - 获取网页字段内容到Javascript变量 [Firefox Addon-SDK]

excel - 在 Excel 中使用公式创建 URL

jquery - 在不触发 div.click 事件的情况下单击 div 中的链接

javascript - 超链接 JQuery 未触发

jQuery 选项卡 - 直接链接到选项卡

JQuery UI : How to get the selected tab to change color without loading jqueryui. CSS

javascript - 如何在 jQuery/Javascript 中编写 switch 语句来测试元素是否具有特定类?

Jquery:IE窗口宽度