prevent-orientation
Version:
Prevent orientation mode on mobile device
49 lines (33 loc) • 1.02 kB
Markdown
Prevent orientation mode on mobile device
[](https://www.npmjs.com/package/prevent-orientation)
[](https://www.npmjs.com/package/prevent-orientation)

```sh
$ yarn add prevent-orientation
```
or
```html
<script src="//unpkg.com/prevent-orientation"></script>
```
```ts
import {PreventOrientation} from 'prevent-orientation';
// Prevent to portrait orientation
new PreventOrientation().preventPortrait();
// Prevent to landscape orientation
new PreventOrientation().preventLandscape();
```
```ts
new PreventOrientation({
text: 'Sorry, this device orientation is not supported',
color: 'rgb(90, 90, 90)',
background:
'linear-gradient(to right, rgb(255, 175, 189), rgb(255, 195, 160))',
fontSize: '1.2rem',
}).preventOrientationToAngle(0);
```
MIT