我想将div的outerheight()值与另一个div的padding-top值相加。这里是我的功能sumding outerHeight with padding给出错误结果
var headerHeight = $('header').outerHeight() + "px";
console.log(headerHeight);
var containerPT = $(".container").css('padding-top');
console.log(containerPT);
var totalSpace = (headerHeight + containerPT);
console.log(totalSpace);
,其结果是:
//headerHeight
474px
//containerPT
150px
//totalSpace
474px150px
结果我需要的当然是474 + 150 = 624px; 我通常总结一些东西,我不知道为什么会发生这种情况,我做错了什么。 任何帮助非常感谢。
我更新了答案,检查出来:) –