欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery監(jiān)聽瀏覽器窗口大小的變化實(shí)例

 更新時間:2017年02月07日 09:24:25   投稿:jingxian  
下面小編就為大家?guī)硪黄猨Query監(jiān)聽瀏覽器窗口大小的變化實(shí)例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

方法一:在標(biāo)簽上加入  onLoad="" onResize=""  方法  寫上對應(yīng)的方法即可

方法二:window.onresize=function(){///.....} 在方法里面寫上對應(yīng)的代碼即可

著兩種方法基本都可以解決問題。

<script>
function adjust(obj){
  var div = document.getElementById("pad");
  var txt = document.getElementById("txt");
  var w = document.body.clientWidth;
  var h = 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();
}
</script>
<body style="margin:0px;height:0px;">
<div id="pad" style="background:red;zoom:1;margin:0px;height:0px;">
  <input type="text" id="txt">
</div>
</body>

以上這篇jQuery監(jiān)聽瀏覽器窗口大小的變化實(shí)例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論