1.0.2 • Published 4 years ago

screen-orientation-js v1.0.2

Weekly downloads
16
License
MIT
Repository
github
Last release
4 years ago

screen-orientation-js

npm package

Displays an animated full-screen message when the mobile device's screen is rotated horizontally.

Some applications or websites may display content properly only in portrait orientation on the mobile devices. To prevent the website's layout from breaking , screen-orientation-js informs the user that the app can't be viewed in landscape orientation.

Installation

$ npm install screen-orientation-js

Usage

const screenOrientationJs = require('screen-orientation-js');
// or 
import * as screenOrientationJs from 'screen-orientation-js';

// Initialize with custom settings
screenOrientation.init({
    color:  "#7c692d",
    bgColor: "#2d7c72",
    animation: false,
    fontSize: 3
});

// or with default 
screenOrientationJs.init();

Using directly in a browser

Place <script> tag in the <head> section.

<script src="https://unpkg.com/screen-orientation-js"></script>

screenOrientationJs is available as a global variable, or window.screenOrientationJs

<script>
  // init with custom settings
  screenOrientationJs.init({bgColor: "#2d7c72"})
  
  // or with default 
  screenOrientationJs.init();
</script>

Options

You can change the default settings by passing the config object. The default setting values will be used ​​for non-passed values.

KeyValue typeDescriptionDefault value
message:stringThe custom message to display.""Landscape orientation is not support..."
color:stringText color.#0000
fontSize:numberFont size. Recommended values 1-6.5
bgColor:stringBackground color.#ffff
animation:booleanThe rotating phone animation.true
iconColor:stringIcon color.#1D1D1D
iconSize:numberIcon size.10
minHeight:numberMin viewport height in landscape mode for the component to be inactive500
1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.2

4 years ago

0.1.3

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago