使用 iframe 在 PC Web 上模拟移动设备



我想在PC页面上预览移动页面,该页面具有iframe来模拟移动设备。但移动事件在 iframe 中不受支持,例如滑动。

如何通过iframe完全模拟移动设备?

<div class="preview>
  <iframe src="http://path.to.my/mobilePage.html"></iframe>
</div>
.preview{
  width:375px;
  height:812px;
}
.preview iframe{
  width:100%;
  height:100%;
}

附言跨现代浏览器。

Chrome具有您想要的功能。

https://developers.google.com/web/tools/chrome-devtools/device-mode/

 <iframe src="https://stackoverflow.com" width="255" height="320"></iframe>

检查这个 : http://mattkersley.com/responsive/

但在技术方面:您可以使用heightwidth内容会对此做出响应。

此外,如果您想使用其移动事件测试您的网站,请尝试使用内置的chrome/firefox扩展程序,只需按Ctrl+Shift+M

最新更新