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;
   }

  

原文地址:https://www.cnblogs.com/baiyq/p/10880138.html