var _headerwidth = $('#header').width();
var _foabgwidth = $('#page-body-inner').width();
console.log(_headerwidth);
console.log(_foabgwidth);
$('.static').css("width",_foabgwidth + "px");
$('.fixed').css("width",_headerwidth + "px");
var staticwidth = $('.static').width();
console.log('staticwidth:'+staticwidth);
使用上面的代码,我的控制台日志如下
940
676
staticwidth:null
我正在尝试为.static
and设置宽度,fixed
但我无法使用我使用过的 jQuery 让它工作。