Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67497

Control of pinch zoom level in webpage

$
0
0

In my webpage, I have buttons so small that I have made it possible for the user to pinch zoom the webpage using

<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />

or he/she will not be able to click them.

(The buttons are bullet like circles that each represent a seat in a theater).

If the user is not logged in when he/she has pressed a button, I want to present a login dialog to the user and I need to do that in zoomed out mode. When the user has logged in, it would be nice to have the previous zoom level restored.

So I need to control the zoom in some way.

How?

What I have tried to set the zoom level is

$("meta[name=viewport]");
meta.prop("content", "scale=1, user-scalable=yes")

That only seems to pan the webpage to a point that is a bit to the left.

What I have tried to get the zoom level is

var zoom = $("html").css("zoom");
console.log("zoom", zoom);

or

var zoom = $("html").css("zoom");
console.log("zoom", zoom);

but they are both giving me 1, regardless of the zoom level.


Viewing all articles
Browse latest Browse all 67497

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>