Webkit iPhone App : How to dynamically change the user zoom (or scale, pich & zoom) in the viewport

Posted by Samuel Michelot on Stack Overflow See other posts from Stack Overflow or by Samuel Michelot
Published on 2010-04-22T13:47:31Z Indexed on 2010/05/13 0:24 UTC
Read the original article Hit count: 767

Filed under:
|
|
|
|

I use JQTouch for an iPhone app. JQtouch disable by default the possibility to pinch&zoom the page. For one page (containing a big image), i need to enable the pinch & zoom feature. This is easy :

var viewport = $("head meta[name=viewport]");
viewport.attr('content', 'width=320, initial-scale=1, maximum-scale=10.0, minimum-scale=1, user-scalable=1');

But after user has play with the pinch & zoom, I need to dynamically reset the zoom (scale) to the default. I tried to reset the viewport:

viewport.attr('content', 'width=320, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;');

After calling the above code, it's not possible to zoom anymore (because of user-scalable=0;), but it doesn't change the current scale to the default.

I am looking for something like setScale(1), or to change an attribute like current-scale=1

Any idea ?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about viewport