Skip to content

yonran/detect-zoom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Javascript Zoom Detector

Forked from https://github.com/yonran/detect-zoom

I removed support for old browsers and cleaned up the original code into a module patern. Supports: IE8+, FF4+, modern Webkit, mobile Webkit, Opera 11.1+

Detect the zoom level of the user's browser using Javascript. This can be used to show higher-resolution canvas or img when necessary.

It may not be complete; I need help testing different browsers. Patches welcome.

Usage

<script src=detect-zoom.js></script>
<script>
  var zoom = DetectZoom.zoom();
  var device = DetectZoom.device(); // Device pixel ratio

  console.log(zoom, device);
</script>

Examples

Demo

Dimensions test


Detect-zoom is dual-licensed under the WTFPL and MIT license, at the recipient's choice.

About

Cross Browser Zoom and Pixel Ratio Detector

Resources

Stars

Watchers

Forks

Packages

No packages published