JavaScript JavaScript - How to get css zoom level? javascript zoom level of browser,javascript zoom level detect,javascript

a simple question. I want to use CSS Zoom level to resize my Site oncklick.

I want to catch the css zoom from "html" element.

CSS

html{zoom:1}

JavaScript

function zoomIn(){
altzoom = document.documentElement.style.zoom;
zoomIn = (altzoom + 0.1);
document.documentElement.style.zoom = zoomIn; 
}

HTML

<button onclick= "zoomIn()">Zoom +</button>

If i click on "zoom +" i only get Zoom level of 0.1 so i think i don't get an output from document.documentElement.style.zoom;

result is: zoom: 0.1;

There are an special value to get current css zoom lvl?

I will be happy to fix it.

Answer:1

Maybe it's because in your CSS file, the attribute zoom of your element is not set, so the JS can't find a value to put in "altzoom" . Try to put it in your CSS declaration.

Answer:2

I have done this to create number of columns based on the data my server returns back. I want to check if the data in the array matches the column name, if it does then return yes else return no. ...

I have done this to create number of columns based on the data my server returns back. I want to check if the data in the array matches the column name, if it does then return yes else return no. ...

  1. datatable rows add array

I am struggling with an excercise question and maybe you could help me. I have to set up a camera and cube with THREE.js. The cube should keep its initial ratio and the camera should look at the ...

I am struggling with an excercise question and maybe you could help me. I have to set up a camera and cube with THREE.js. The cube should keep its initial ratio and the camera should look at the ...

For the CMS page editor in Magento,i would like to change the formatting of the H tags in the tinyMce editor. I would like something like for H1 tag, it is in red, bold, font:36px. how would i go ...

For the CMS page editor in Magento,i would like to change the formatting of the H tags in the tinyMce editor. I would like something like for H1 tag, it is in red, bold, font:36px. how would i go ...

Does anyone know why the height could be zero here? $(document).ready(function () { alert($("#hello").height()); }); <script src="https://ajax.googleapis.com/ajax/...

Does anyone know why the height could be zero here? $(document).ready(function () { alert($("#hello").height()); }); <script src="https://ajax.googleapis.com/ajax/...

  1. jquery element height returns 0
  2. element height returns 0
  3. jquery height returns 0
  4. jquery div height returns 0