Mobile-Orientation
Detect Mobile Portrait/Landscape on resize. See demo.
Browser compatibility
See MDN.
Install
npm install --save mobile-orientation
Usage
const orientation = console // 'portrait' orientation // portrait or landscapeorientation // portraitorientation // landscape
Alternatively, the state can be utilized within a computed property, a la Vue.js Computed Property.
// Vue Component { return orientation: } computed: { return thisorientationisPortrait } { return thisorientationisLandscape }
Options
debounceTime
- Type:
Number
- Default:
50
- Format: Milliseconds
- Description: Time to wait before invoking detection.
withTouch
- Type:
Boolean
- Default:
false
- Description: Include touch-device when testing mobile.
portraitMediaQuery
See MDN for media queries syntax.
- Type:
String
- Default:
screen and (max-device-aspect-ratio: 1/1)
- Format: CSS Media Query
- Description: CSS Media Query to test against portrait.
landscapeMediaQuery
See MDN for media queries syntax.
- Type:
String
- Default:
all
- Format: CSS Media Query
- Description: CSS Media Query to test against landscape.