1

一些帮助将不胜感激 - 我正在尝试显示带有来自另一个页面的链接的特定选项卡。[此处显示的示例]目标页面包含大部分代码 - 请记住选项卡运行良好,因为它们是我只需要能够定位选项卡中的特定内容

4

1 回答 1

1

这应该有效:

// 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');
}
于 2012-05-09T11:03:48.547 回答