@kptn/screen-orientation
v0.1.4
Published
Cross-browser screen orientation management in JS
Downloads
3
Readme
screen-orientation.js
Cross browser screen rotation management in pure vanilla javascript
Installation
NPM
npm install @kptn/screen-orientation.js
Bower (deprecated)
bower install gotandev/screen-orientation.js
Usage
Full example on CodePen
Initialization
let so = screenorientation();
Change listener
// Event listener
// On screen resolution changes
// Returns screen resolution instance.
so.change(callback);
You can trigger manually your event by calling with null argument.
// Trigger manually change orientation event
so.change();
Values
// Returns rotation angle : 0 or 90
so.angle()
// Landscape display mode ?
so.isLandscape()
// Portrait display mode ?
so.isPortrait()
License
MIT License