@kptn/screen-orientation

0.1.4 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @kptn/screen-orientation

Weekly Downloads

2

Version

0.1.4

License

MIT

Unpacked Size

7.32 kB

Total Files

6

Last publish

Collaborators

  • damien.cuvillier