Is there a chance to change zoom value by JS. I'm trying to do something like this:
document.getElementsById("div").style.zoom="150%";
Thanks for help.
Is there a chance to change zoom value by JS. I'm trying to do something like this:
document.getElementsById("div").style.zoom="150%";
Thanks for help.
I have no idea what the zoom property is, but if you want to zoom in a <div>
, you should use the css transform:scale(x)
property, but you could set this property via js like this:
document.getElementsById("elementId").style.transform ="scale(1.5)";
https://jsfiddle.net/og2tqez3/
you can change the 1.5
value to the amount you want to zoom by, 1.5 means 150%, etc...
however be careful when setting this property with js, because you literally overwrite any other transforms on that element, in that case you should set the old transform value and the zoom value and seperate them with spaces like this:
document.getElementsById("elementId").style.transform ="scale(1.5) transform:translate(0,-50%)";
My bad, so i now know what the zoom
property is, but scale
is more widely supported and optimal.
I've just found solution. I changed the class.
document.getElementById(div).className = "class";
http://stackoverflow.com/a/9441618/7349445 – Roy Bogado Jan 02 '17 at 15:11