0.1.4 • Published 3 years ago

@kptn/screen-orientation v0.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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