当窗口宽度小于 1200px 时,我使用此 JQuery 使一个 div 与另一个 div 的宽度相同,并且无法弄清楚我犯了什么错误。
var width = $('.creative').outerWidth();
if ($(window).width() < 1200){
$('#right-child').css('width', width);
}else{
console.log('more than 1200');
};
最佳答案
尝试将值与单位名称连接起来。
$('#right-child').css('宽度', width + 'px');
关于javascript - jQuery 中如何让 div 的宽度相同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36757476/