在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ 如何理解window.screen.height哪怕是再加上1px高度也會(huì)變得非

如何理解window.screen.height哪怕是再加上1px高度也會(huì)變得非常高的問題

這是獲取屏幕高度的代碼:

mounted() {
    document.getElementsByClassName("bgColor")[0].style.cssText =
      "width: 100%; height: " +
      window.screen.height +
      "px;z-index: -1; background-color: #f5f5f5";
  }

這是滿屏的截圖,下面的余額支付選項(xiàng)下拉不下去
這是滿屏的截圖

這是獲取屏幕高度,另外再加46px的代碼:


mounted() {
    document.getElementsByClassName("bgColor")[0].style.cssText =
      "width: 100%; height: " +
      window.screen.height +
      "46px;z-index: -1; background-color: #f5f5f5";
  }

這是這是滿屏再加46px的截圖,高度明顯增加了不止46px,另外一個(gè)問題是想設(shè)置height:auto,但是并不起什么作用,哪位大神踩過這些坑的
圖片描述

回答
編輯回答
陌如玉

(window.screen.height + 46) + "px;z-index: -1; background-color: #f5f5f5";

2017年8月21日 12:55
編輯回答
陌如玉

我感覺這里是不是不能這樣寫

window.screen.height + "46px;z-index: -1; background-color: #f5f5f5";

//這樣?
window.screen.height + 46 + "px;z-index: -1; background-color: #f5f5f5";
640 + "46px" = 64046px;
640 + 46 + "px" = "686px";
2018年2月8日 07:49
編輯回答
寫榮

我覺得拉不下去你可以考慮給 document.getElementsByClassName("bgColor")[0] 這個(gè)元素設(shè)置margin或者padding的? 你是想要超出部分滾動(dòng)的效果吧?

2017年10月25日 04:42