ABOUT
This plugin allows you to detect browser's and separate element's zoom level.
It is lightweight and has no dependencies!
INSTALLATION
npm install zoom-level# or via yarn yarn add zoom-level
INSTALLATION NOTE:
This lib is written in ES6+ and delivering with both, transpiled and untranspiled versions:
main
field ofpackage.json
is pointing to transpiled ES3-compatible version with CJS modules resolution;module
field is pointing to transpiled ES3-compatible version with ES modules resolution;esnext
field is pointing to the ES6+ version with ES modules resolution;
Depending on your targets you may have to use Webpack and/or
Babel to pull untranspiled version of package.
See some tips on wiring thing up: https://2ality.com/2017/06/pkg-esnext.html
USAGE
; ; // 1; window;
Or, in case you want to detect separate element's zoom level (they can use own zoom
CSS property which stacks with browser's one);
; const zoomedBlock = document;zoomedBlockstylezoom = 05;zoomedBlockstylewidth = "150px";zoomedBlockstyleheight = "150px";zoomedBlockstylemargin = "32px";zoomedBlockstylepadding = "32px";zoomedBlockstylebackground = "rgba(0,0,0,.05)";zoomedBlockinnerText = "Lorem ipusm dolor sit amet";document; ; // 0.5; window;
TESTS
Sadly i have no idea how to manage testing of this package, due to there is no known ways to control browser's zoom level.
If you know how to do it - please let me know.
Related projects
- react-scrollbars-custom — The best React custom scrollbars component. Allows you to customise scrollbars as you like it, crossbrowser!
- @xobotyi/scrollbar-width — A tool to get browser's scrollbars width.
- @xobotyi/should-reverse-rtl-scroll — A tool detecting if RTL scroll value should be negative.