我有许多表示表格的平铺容器(带有内联 block 的 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;
}
有没有办法强制 chrome 重新渲染容器?
最佳答案
通过向容器添加类
$(".GeneratedTableWrapper").AddClass("Resized")
Chrome 知道重新渲染这些容器从而防止重叠。
关于jquery - Chrome : Setting width on inline-block element programatically,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8097422/