0
我想设置元素的margin-bottom来始终匹配不同元素height的值。设置一个元素的边距来动态保持与另一个元素的高度相同jQuery
所以,如果#footer当前的高度是310px,我希望.content-wrap的margin-bottom也是310px,而且无论#footer高度如何,它们都是相同的。我有下面的代码,但它目前没有任何影响边缘...我没有使用jQuery存储和输出值/ css之前,你可以告诉!
$(function() {
updateDivsMargins();
$(window).resize(updateDivsMargins);
function updateDivsMargins() {
$('.content-wrap').each(function() {
$(this).css({
'margin-bottom': $("#footer").height();,
});
});
}
});
AGHHH !!!!我不知道我太亲近了,以为我离开了一英里。非常感谢您花时间纠正我。干杯。 –
请务必记得检查浏览器控制台是否有任何错误。它们对调试总是有帮助的。干杯! – Preetesh