解决window.onresize事件多次调用问题:

Js代码 解决window.onresize事件多次调用问题
  1. <script type="text/javascript">   
  2. var  resizeTimer = null;   
  3.   
  4. function doResize(){   
  5.   alert("width="+(document.documentElement||document.body).clientWidth +    
  6.        "   Height="+(document.documentElement||document.body).clientHeight);   
  7. }   
  8.   
  9. window.onresize = function(){   
  10.   if(resizeTimer) clearTimeout(resizeTimer);   
  11.   resizeTimer = setTimeout("doResize()",300);   
  12. }   
  13. </script>  

相关文章:

  • 2022-03-09
  • 2022-12-23
  • 2022-01-25
  • 2022-02-24
  • 2021-11-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-06
  • 2022-12-23
  • 2021-10-26
相关资源
相似解决方案