-
-
Save caot/44e64f4fb102767839b2aef85dd739fc to your computer and use it in GitHub Desktop.
Getting browser Zoom level
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//for zoom detection | |
px_ratio = window.devicePixelRatio || window.screen.availWidth / document.documentElement.clientWidth; | |
$(window).resize(function(){isZooming();}); | |
function isZooming(){ | |
var newPx_ratio = window.devicePixelRatio || window.screen.availWidth / document.documentElement.clientWidth; | |
if(newPx_ratio != px_ratio){ | |
px_ratio = newPx_ratio; | |
console.log("zooming"); | |
return true; | |
}else{ | |
console.log("just resizing"); | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment