放在底部的jQuery选项卡控件不起作用

时间:2012-11-14 23:02:34

标签: javascript jquery

我正在使用此解决方案来multiple tabs in one page

$(".tab_content").not(':first-child').hide();
var tabs = $('.tabs li');

tabs.filter(':first-child').addClass('active');

tabs.click(function() {
    var current = $(this);

    if(!current.hasClass('active')){
        current.addClass('active').siblings().removeClass('active');
        var activeTab = current.find("a").attr("href");
        current.parent().next().children().hide().filter(activeTab).fadeIn();
    }

    return false;
});

我需要在标签内容之后放置标签控件。 但它不会起作用。如果选项卡控件放在选项卡内容之前,它可以正常工作。 你能救我吗?

这是我的jsfiddle

1 个答案:

答案 0 :(得分:1)

将next()更改为prev() - 因为现在兄弟姐妹在标签

之前
current.parent().prev().children().hide().filter(activeTab).fadeIn();

http://jsfiddle.net/Kf2f4/