bla*_*d Ψ 1 javascript jquery jquery-ui
我有一个女主角,它的高度是使用jquery自动计算的
$(window).load(function(){
$(window).resize(function(){
var height = $(this).height() - $("#header").height() + $("#footer").height() - 35
$('#content').height(height);
})
$(window).resize();
});
Run Code Online (Sandbox Code Playgroud)
我有另一个带id的div,content2我想将存储在变量中的值设置var height为margin-top.我怎样才能做到这一点??
提前致谢...:)
blasteralfred
Joh*_*hnP 10
使用该.css()方法.
$(window).load(function(){
$(window).resize(function(){
var height = $(this).height() - $("#header").height() + $("#footer").height() - 35
$('#content').height(height);
$('#content2').css('marginTop', height); // <-- set here
});
$(window).resize();
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10993 次 |
| 最近记录: |