是否可以通过 Javascript 更改 Mobile Safari 中的页面缩放?
我有一个使用 jquerymobile 的网站。它加载一个初始网页,然后当单击其他页面时,它们会加载到滑过顶部的“覆盖层”中。
就像这样: http://jquerymobile.com/demos/1.0a4/
..除了我的启用了捏缩放功能。
我希望缩放状态在用户看到的每个页面上都是独立的。因此,如果用户从第一页开始,打开“叠加层”,放大,然后关闭“叠加层”——我希望第一页重置为原始缩放级别。
这可能吗?
I have a site using jquerymobile. It loads an initial webpage, and then as other pages are clicked, they are loaded in an "overlay" which slides over the top.
Just like this:
http://jquerymobile.com/demos/1.0a4/
..except mine has pinch zoom enabled.
I want the zoom state to be independent on each page the user sees. So, if a user starts on page one, opens an "overlay", zooms in, and then closes the "overlay" -- I want the first page to reset to the original zoom level.
Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实际上,我只需要自己解决这个特定问题,所以我希望这个答案对其他人有帮助。我具体遇到的情况是,我有一个网站(更像是一个网络应用程序),它不是采用响应式设计构建的,但仍然旨在支持移动设备。界面功能之一是包含一个包含表单的 jQuery 对话框窗口。当用户在 Droid 或 iPhone 等移动电话上填写该表单时,十分之九的用户会“捏缩放”来填写表单。您需要做的就是在某些事件上触发此功能,在我的例子中,是单击提交按钮。
当然,您可以将宽度属性更改为网站框架的宽度。但这就能解决问题。
Actually, I just had to solve that specific problem myself so I hope this answer helps out someone else. The scenario I ran up against specifically is that I have a website (which is more like a web app) that was not built in a responsive design, but still intended to be mobile friendly. One of the interface features is the inclusion of a jQuery Dialog window containing a form. When a user fills out that form on a mobile phone such as a Droid or an iPhone, 9 times out of 10, the user will "pinch zoom" to fill out the form. All you need to do is trigger this function on some event, in my case, it was the click of the submit button.
Of course, you will change the width attribute to whatever the width of the framework of your website is. But this will do the trick.
不,无法控制浏览器缩放。您应该使用 JavaScript 在浏览器中缩放(或缩放)对象。最好将
user-scalable
设置为no
来关闭收缩No there is no way to control browser zoom. You should use JavaScript to zoom (or scale) your objects in the browser. It's best to switch pinching off by setting
user-scalable
tono