亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

響應式設計模式在屏幕旋轉后沒有為 window.innerWidth 返回正確的值

響應式設計模式在屏幕旋轉后沒有為 window.innerWidth 返回正確的值

開心每一天1111 2022-10-27 15:42:29
這是一個Firefox錯誤還是我搞砸了?如果我在真實設備(例如 Android)上使用 chrome 甚至 Firefox,沒有問題,它似乎只影響 Firefox 的響應式設計模式。這是復制問題所需的完整代碼:<html><head><meta charset="UTF-8"><meta name="viewport" id="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/></head><body><script>var pageInPortraintMode;// Prevent keyboard from squeezing the entire UIaddEventListener("load", function() {  pageInPortraintMode = window.innerHeight > window.innerWidth;  document.getElementById("viewport").setAttribute("content", "width=" + window.innerWidth + ", height=" + window.innerHeight + ", initial-scale=1.0, maximum-scale=1.0, user-scalable=0");})// Listen to window resizes to detect orientation changeswindow.addEventListener("resize", windowSizeChanged);function windowSizeChanged() {  alert(window.innerWidth + "x" + window.innerHeight);  if (((pageInPortraintMode === true) && (window.innerHeight < window.innerWidth)) || ((pageInPortraintMode === false) && (window.innerHeight > window.innerWidth))) {    pageInPortraintMode = window.innerHeight > window.innerWidth;    document.getElementById("viewport").setAttribute("content", "width=" + window.innerWidth + ", height=" + window.innerHeight + ", initial-scale=1.0, maximum-scale=1.0, user-scalable=0");  }}</script><div style="width:100%; height:100%; background-color:#000; position:fixed; left:0; top:0"></div></body></html>要復制進入響應式設計模式 (Ctrl+Shift+M),請加載 html,然后按“旋轉視口”按鈕。
查看完整描述

1 回答

?
ABOUTYOU

TA貢獻1812條經驗 獲得超5個贊

看來這是一個可重現的 Firefox 錯誤 https://bugzilla.mozilla.org/show_bug.cgi?id=1650024


查看完整回答
反對 回復 2022-10-27
  • 1 回答
  • 0 關注
  • 120 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號