meUseRem is a small utility script to to track font-resize and convert values between px and rem.
A resize
event is triggered when the user resizes the font-size of the browser.
Include me-use-rem.min.js
included in the dist
folder in your HTML page.
You can find the original JavaScript file in the src
folder of this package.
meUseRem has AMD support. This allows it to be lazy-loaded with an AMD loader, such as RequireJS.
Convert px to rem:
meUseRem.px2rem(PX-VALUE);
Convert rem to px:
meUseRem.rem2px(REM-VALUE);
Remove the utility
meUseRem.destroy();
Re-initialize the utility
meUseRem.init(POLL_INTERVAL); // POLL_INTERVAL int optional; time between font-size-change polls in ms; default is 200
You can install meUseRem using npm or Bower.
$ npm install me-use-rem
or
$ bower install me-use-rem
meUseRem is licenses under the MIT licence.