js 实时获取屏幕高度并赋值

   var that = this;
    var h = 1344,w=750;
    var orderHight1 = document.body.clientHeight;
    var orderWidth1 = document.body.clientWidth;
    that.orderHight = orderWidth1*(h/w);
    window.onresize = function(){
      orderWidth1 = document.body.clientWidth;
      var orderHight2 = orderWidth1*(h/w);
      that.orderHight = orderHight2;
   }

  

posted @ 2019-05-17 10:50  半浮生-byq  阅读(1025)  评论(0)    收藏  举报