0
我已经设置了一个jQuery宽度计算来调整我的窗口的大小,它一切正常,但我发现,当我调整和拉伸时,有一个'故障'或分裂秒的容器的宽度变化,它们重叠并留下很大的差距。我明白这是因为jQuery正在执行它的计算,但这是正常的,并且无论如何都有它吗?Jquery调整大小计算故障
if ($("#Grid").css("margin-bottom") === "1px") {
oneCol();
}
if ($("#Grid").css("margin-bottom") === "0px") {
twoCol();
}
function oneCol() {
$('#middle').hide();
$('#Grid').css('width', '100%').css('width', '-=170px');
}
function twoCol() {
$('#middle').show();
$('#middle').outerWidth(function() {
return ($(this).parent().width() * 0.5) - $('#left').outerWidth()/2;
});
$('#Grid').outerWidth(function() {
return ($(this).parent().width() * 0.5) - $('#left').outerWidth()/2;
});
}
$(window).on('resize', function() {
if ($("#Grid").css("margin-bottom") === "1px") {
oneCol();
}
if ($("#Grid").css("margin-bottom") === "0px") {
twoCol();
}
});
这是我的JSFiddle。
我没有看到调整大小的小故障:这是特定于浏览器的?如果是这样,这是什么浏览器出现? – dhc
我在Chrome上查看它。 – Alga