一些帮助将不胜感激 - 我正在尝试显示一个带有来自另一个页面的链接的特定选项卡。示例 [here]目标页面包含大部分代码 - 请记住选项卡工作得很好,因为它们是我只需要能够定位选项卡中的特定内容
最佳答案
这应该有效:
// remove current selection
$(".tablist ul.tabs li").removeClass("current");
// check if the desired tab exists
if ( $("#" + (window.location.hash.replace("#", ""))) ) {
// selected desired tab
$("#" + (window.location.hash.replace("#", ""))).addClass("current");
} else {
// select first tab
$('ul.tabs li:first').addClass('current');
}
关于jquery - 从另一个页面链接到特定选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10513726/