如何在不刷新整个页面重置视口比例? [英] How to reset viewport scaling without full page refresh?

查看:90
本文介绍了如何在不刷新整个页面重置视口比例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页,有视meta标签设置为true的用户可升级的属性(<一href="http://developer.apple.com/library/safari/#documentation/appleapplications/reference/SafariHTMLRef/Articles/MetaTags.html#//apple_ref/html/const/viewport">Safari参考, Android的参考)。因此,用户的浏览器识别的属性(如移动Safari浏览器,Android浏览器)可以捏缩放页面。然而,存在刷新大多数使用AJAX页面,但不执行刷新整个页面的链接。我想视口缩放重置为使用JavaScript的初始值。但我无法弄清楚如何做到这一点。

I have a web-page that has the "user-scalable" attribute of the viewport meta tag set to true (Safari reference, Android reference). So users with browsers that recognize the attribute (such as Mobile Safari, Android Browser) can pinch to scale the page. However, there is a link that refreshes most of the page using AJAX, but does not perform a full page refresh. I'd like to reset the viewport scaling to the initial value using JavaScript. But I can't figure out how to do this.

唯一的解决办法似乎是一个完整的页面刷新。任何人都知道一个更好的方式?

The only solution seems to be a full page refresh. Anyone know of a better way?

感谢。

推荐答案

pretty的简单交易使用jQuery来设置视口:

Pretty simple deal to set the viewport using jQuery:

$('meta[name=viewport]').attr('content', 'width=device-width, initial-scale=1');

这使用jQuery移动作为一个框架,适用于移​​动Safari浏览器。

This works on Mobile Safari using jQuery Mobile as a framework.

这篇关于如何在不刷新整个页面重置视口比例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆