jquery自动检测屏幕变化

setBanerHeight();
  // window.onload = function() {
  function setBanerHeight() {
    console.log('setBanerHeight');
    var domHeight = $(document.body).height();
    var bannerHeight = domHeight - 228;
    $('.image').css({'height':bannerHeight+'px'})
  }
  // }
  $(window).bind("load resize",function(){
    setBanerHeight();
 });
$(window).bind("load resize",function(){
    setBanerHeight();
 });

 

posted @ 2020-08-20 17:56  Deer_Lin  阅读(650)  评论(0)    收藏  举报