js问题,当窗口变化时,如何让页面也跟着变 js问题,当窗口变化时,如何让页面也跟着变就像GMail一样的。就像是有些页面里的div是用的绝对定位。如果让这个也改变在窗口里的绝对位置。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 而且好像GMail还不能查看源代码,有没有人知道是怎么回事? 界面大小改变会触发事件window.onresize = function(){ follow();};function follow(){//自己写需要执行的方法如改变Div位置} 为什么 window.onresize 调用时 follow();会执行三次? window.onload = function() { if (!window.event) return; var bgimg = document.getElementById("bgimg"); window.onresize = function() { bgimg.style.width = document.body.clientWidth + "px"; bgimg.style.height = document.body.clientHeight + "px"; }; window.onresize();}背景图片大小随窗口大小变化,参考下 function resizeLogin(id){document.getElementById(id).style.top=(document.documentElement.offsetHeight/2 || document.documentElement.scrollHeight/2||document.body.scrollHeight/2||document.body.offsetHeight/2) -251 + "px";document.getElementById(id).style.left=(document.documentElement.offsetWidth/2 || document.documentElement.scrollWidth/2||document.body.scrollWidth/2||document.body.scrollWidth/2) -252 + "px"; document.getElementById(id).style.display="block";}<body onresize="resizeLogin(***);" onload="resizeLogin(***);"> <div id=***></div></body> 关于Syntax error on tokens, delete these tokens错误,大家帮帮忙!!谢谢 短信接口发送问题 请教一个关于线程的问题,在线求解 Hibernate左连接出错? 急急急,JSP上传超大文件的问题??? 随机取数 使用“where”子句做为存储过程参数的问题?在线等!! 关于登陆页面的一个小问题! 送分啦!想学javabean,大家给点意见,进者有分,特别有请Norwaywoods(挪威的森林) linux系统上的tomcat端口老是被占用。 ssh项目读取图片显示在页面上 struts2 action 问题
window.onresize = function(){
follow();
};
function follow(){
//自己写需要执行的方法如改变Div位置
}
为什么 window.onresize 调用时 follow();会执行三次?
if (!window.event) return;
var bgimg = document.getElementById("bgimg");
window.onresize = function() {
bgimg.style.width = document.body.clientWidth + "px";
bgimg.style.height = document.body.clientHeight + "px";
};
window.onresize();
}
背景图片大小随窗口大小变化,参考下
function resizeLogin(id){
document.getElementById(id).style.top=(document.documentElement.offsetHeight/2 || document.documentElement.scrollHeight/2||document.body.scrollHeight/2||document.body.offsetHeight/2) -251 + "px";document.getElementById(id).style.left=(document.documentElement.offsetWidth/2 || document.documentElement.scrollWidth/2||document.body.scrollWidth/2||document.body.scrollWidth/2) -252 + "px";
document.getElementById(id).style.display="block";
}
<body onresize="resizeLogin(***);" onload="resizeLogin(***);">
<div id=***>
</div>
</body>