How to get the device orientation value?
■ Summary
- This is the code to get the device orientation value.
■ Reference Sites
- https://developer.tizen.org/community/tip-tech/flexible-layouts-web-applications
- This is the code to get the device orientation value.
■ Reference Sites
- https://developer.tizen.org/community/tip-tech/flexible-layouts-web-applications
window.onload = function () {
tizen.systeminfo.addPropertyValueChangeListener('DEVICE_ORIENTATION', function (device) {
switch(device.status){
case "PORTRAIT_PRIMARY" :
// TODO : PORTRAIT_PRIMARY
console.log("PORTRAIT_PRIMARY");
break;
case "LANDSCAPE_PRIMARY" :
// TODO : LANDSCAPE_PRIMARY
console.log("LANDSCAPE_PRIMARY");
break;
case "PORTRAIT_SECONDARY" :
// TODO : PORTRAIT_SECONDARY
console.log("PORTRAIT_SECONDARY");
break;
case "LANDSCAPE_SECONDARY" :
// TODO : LANDSCAPE_SECONDARY
console.log("LANDSCAPE_SECONDARY");
break;
}
});
};
// If you want to use the FlexibleLayout, you need to use the media query in the css files.
/***************************************
* CSS File
***************************************/
@media all and (orientation: portrait) {
div {
background-color: red;
}
}