我在我的网站上使用 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");
关于jQuery 选项卡。从某个位置打开某个选项卡。可能的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3202734/