Jquery 可展开可折叠DIV列表

Jquery 可展开可折叠DIV列表,jquery,Jquery,我有一个我一直在做的 如果您扩展列表,它将非常有效,但是 如果您折叠列表,则表格右侧会闪烁 我怎样才能阻止这种事情发生 下面是Jquery代码的一个片段 $(".header").click(function () { $header = $(this); //getting the next element $content = $header.next(); //open up the content needed - toggle the slide- if

我有一个我一直在做的

如果您扩展列表,它将非常有效,但是
如果您折叠列表,则表格右侧会闪烁

我怎样才能阻止这种事情发生

下面是Jquery代码的一个片段

$(".header").click(function () {
    $header = $(this);
    //getting the next element
    $content = $header.next();
    //open up the content needed - toggle the slide- if visible, slide up, if not slidedown.
        $content.slideToggle(200, function () {
            $('.contentCol', this).fadeToggle(400);

    });
});
解决
添加
浮动:左到。内容,使其在调整大小时保持位置

.content{
   float:left; 
}

只需将此添加到css中即可

.header,.content{
    overflow: hidden;
    clear: both;
}  

这里的工作示例

这同样有效,但@Spokey在绘图时要快一点。向上投票安慰