获取“视口”的位置在移动游猎中?

发布于 2024-08-28 14:06:58 字数 62 浏览 4 评论 0原文

有没有办法确定移动Safari中“视口”在网页上的位置?比如手机当前在页面上看到的 x、y、w、h 像素位置?

Is there a way to determine the position of the "viewport" in mobile safari on a web page? Like x, y, w, h pixel positions of what the phone is currently seeing on the page?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

没有你我更好 2024-09-04 14:06:58

在 javascript(在 Mobile Safari 上)中,您可以使用 window.pageXOffset 和 window.pageYOffset 获取 x 和 y 偏移量,使用 window.innerWidth 和 window.innerHeight 获取 w 和 h。

In javascript (on Mobile Safari) you can use window.pageXOffset and window.pageYOffset to get the x and y offsets, window.innerWidth and window.innerHeight to get w and h.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文