Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/deebloo/device-orientation

Very simple Web component that maps the device orientation to attributes. Polymer or vanilla
https://github.com/deebloo/device-orientation

Last synced: 3 months ago
JSON representation

Very simple Web component that maps the device orientation to attributes. Polymer or vanilla

Awesome Lists containing this project

README

        

# ``````

A Web Components for detecting device orientation. Can be used with or without Polymer. Usage is exactly the same.

```
npm i --save device-orientation

```

```HTML

```

### Example
```HTML

Left Right: 0


Left Right: 0


Left Right: 0

var el = document.getElementById('orientationEl');
var lr = document.getElementById('lr');
var fb = document.getElementById('fb');
var direction = document.getElementById('direction');

el.orientationChanged = function () {
lr.innerText = el.lr;
fb.innerText = el.fb;
direction.innerText = el.direction;
};

```

### properties

#### lr
Type: Number

left to right value

#### fb
Type: Number

front to back value

#### direction
Type: number

direction value