最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
jQuery监听浏览器窗口大小的变化实例
时间:2022-06-25 17:18:00 编辑:袖梨 来源:一聚教程网
方法一:在标签上加入 onLoad="" onResize="" 方法 写上对应的方法即可
方法二:window.onresize=function(){///.....} 在方法里面写上对应的代码即可
着两种方法基本都可以解决问题。
| 代码如下 | 复制代码 |
functionadjust(obj){ vardiv = document.getElementById("pad"); vartxt = document.getElementById("txt"); varw = document.body.clientWidth; varh = document.body.clientHeight; div.style.width = w/3; div.style.height = h/3; txt.style.width = w/6; txt.style.height = h/6; } window.onload=function(){ window.onresize = adjust; adjust(); }
| |
相关文章
- 搜狗手机输入法怎么调大小写字母 06-21
- breeno指令可以卸载吗 06-21
- 搜有红包怎么多得积分 06-21
- 华为nova11预计上市时间 06-21
- 云成绩如何注册账号 06-21
- UG10.0提示初始化错误 06-21