Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/deebloo/device-orientation
- Owner: deebloo
- Created: 2015-06-08T03:13:43.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T17:39:25.000Z (about 1 year ago)
- Last Synced: 2024-10-16T09:15:28.496Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 193 KB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
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
```HTMLLeft 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: Numberleft to right value
#### fb
Type: Numberfront to back value
#### direction
Type: numberdirection value