Chrome:以编程方式设置内联块元素的宽度

时间:2011-11-11 17:05:20

标签: jquery html css

我有许多代表表

的平铺容器(带有内联块的div)

[] [] []

当我更改其中一个容器的宽度时,Chrome无法“重新渲染”它们,而且桌子现在互相溢出。 (这只发生在chrome中)

[[]] []

// Updates each container with the correct HTML and the appropriate width values
function UpdateContainer(crosstab)
{
    var container = $(".GeneratedTableContainer").filter("[index='" + crosstab.Index + "']").find(".GeneratedTableContent");
    container.html(crosstab.Html);

    // Capture the width of the table and update the .GeneratedTableContainer and .GeneratedTableWrapper to prevent overflow.
    var width = container.find(".Crosstab").css("width");
    container.closest(".GeneratedTableContainer").css("width", width);
    container.closest(".GeneratedTableWrapper").css("width", width);
}



div.GeneratedTableWrapper
{

display: inline-block;
min-width: 500px;
width: auto;
margin-left: 5px;
}

div.GeneratedTableContainer
{
margin-top: 5px;
min-width: 500px;
width: auto;
border: 1px solid #dddddd;
position: absolute;
top:0px;
bottom:5px;
}

有没有办法迫使铬重新放回容器?

1 个答案:

答案 0 :(得分:0)

通过向容器添加类

$(".GeneratedTableWrapper").AddClass("Resized")

Chrome知道要重新放置这些容器,从而防止重叠。

相关问题