Enable/disable zoom on iPhone safari with Javascript?
Posted
by msqr
on Stack Overflow
See other posts from Stack Overflow
or by msqr
Published on 2010-05-01T13:04:14Z
Indexed on
2010/05/01
13:07 UTC
Read the original article
Hit count: 238
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);
}
}
© Stack Overflow or respective owner