Enable/disable zoom on iPhone safari with Javascript?
- by msqr
I have 1 page which has 2 DIV elements which is shown/hidden based on user click on action buttons with javascript, I would like to toggle scaling on action button click.
I tried with below javascript and it is changing viewport meta but getting no effect.
Any suggestions?
Blockquote
var ViewPortAllowZoom = 'width=device-width;';
var ViewPortNoZoom = 'width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no;';
function AllowZoom(flag) {
if (flag == true) {
$('meta[name*=viewport]').attr('content', ViewPortAllowZoom);
}
else {
$('meta[name*=viewport]').attr('content', ViewPortNoZoom);
}
}