window.onresize事件

时间:2020-01-21 18:00:42   收藏:0   阅读:1631

定义和用法

onresize 事件会在窗口或框架被调整大小时发生。

语法

In HTML:

<element onresize="SomeJavaScriptCode">

JavaScript 中:

window.onresize=function(){SomeJavaScriptCode};
 

实例

window.onresize=function(){

var bHeight = document.body.clientHeight;//网页可见区域高
$("#unfiledFather").css("height",(bHeight-70-50)+"px");//左边
$("#filedFather").css("height",bHeight-70+"px");//右边

};

实际效果gif图:技术图片

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!