2011-04-16 56 views
0

Drupal 7具有包含horizontal_tab.js文件的字段组模块。使用网址激活Drupal 7选项卡

在这个文件中,我发现这个书面

// If the current URL has a fragment and one of the tabs contains an 
// element that matches the URL fragment, activate that tab. 
if (window.location.hash && $(window.location.hash, this).length) { 
    tab_focus = $(window.location.hash, this).closest('.horizontal-tabs-pane'); 
} 

有人能解释这是如何工作,我应该叫什么确切的网址,使某个特定的标签被激活。

回答

2

如果您目前的网址是一样的东西http://www.example.com/test.htm#part2:

的location.hash将会给你的哈希值 即#part2

从他们的评论。

// If the current URL has a fragment and one of the tabs contains an 
// element that matches the URL fragment, activate that tab. 

意味着如果散列值相匹配,他们正试图用类来找到最接近的元素

'.horizontal-tabs-pane' 

如果是这样,他们的重点选项卡。

1

我们field_group模块具有一个文件名与模块/ field_group /水平的选项卡/水平tabs.js

并且在行号38这个文件添加此行alert(this.id) perticular标签及其打印ID。找到这个ID后,您可以在您的网址通过以#(哈希)

例如:添加此ID带有#符号alert(this.id);

页面URL后因此它在默认情况下指定打开的标签标识的

组合变这样

语法=>node_YourContentTypeName_full_group_YourFieldName

示例=>node_product_full_group_item_name

这里的产品是内容类型,item_name是字段名称

相关问题