I dynamically changed the meta viewport
tag on several of my mobile sites when I want to enable scaling for the image or something else that requires the user to search for a little text:
var $viewport = $('meta[name="viewport"]'), default_viewport = $viewport.attr('content'); $(document).delegate('#page-id-one, #page-id-two', 'pageshow', function () { //these are the pages that you want to enable zooming $viewport.attr('content', 'width=device-width,initial-scale=1.0,maximum-scale=5.0'); }).delegate('#page-id-one, #page-id-two', 'pagehide', function () { $viewport.attr('content', default_viewport); });
This code will be included after jQuery and the meta viewport
tag. Obviously, you can modify the contents of the viewport
element as you wish (I believe Safari will allow maximum-scale
10
).
source share