Crocsx Crocsx - 1 year ago 738
HTML Question

Force page zoom at 100% with JS

I created a little game in Canvas, but I have a problem.

Some users who have the default zoom set to something other than 100% can't see the entire game page...

I searched on the internet for a solution to this problem but couldn't find one...

I have already used:

zoom: 100%;
in CSS.

<meta name="viewport" content="initial-scale=1.0 , minimum-scale=1.0 , maximum-scale=1.0" />


style="zoom: 75%"

Can someone help me please.

Thank you

Answer Source

You can set zoom property on page load = 1.0

But, zoom is not a standard property for all browsers, I recommend using transform instead.

var scale = 'scale(1)'; =  scale;    // Chrome, Opera, Safari =   scale;       // IE 9 = scale;     // General

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download