Webkit iPhone App : How to dynamically change the user zoom (or scale, pich & zoom) in the viewport
- by Samuel Michelot
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 ?