What would be the best approach to detect whenever the user changes the orientation of his phone. I am talking for a mobile site not for a native app.
Thanks,
What would be the best approach to detect whenever the user changes the orientation of his phone. I am talking for a mobile site not for a native app.
Thanks,
window.addEventListener('onorientationchange', function () {
if (window.orientation == -90) {
//do stuff
}
if (window.orientation == 90) {
//do stuff
}
if (window.orientation == 0) {
//do stuff
}
}, true);