Device Orientation API
window.addEventListener('deviceorientation', function(event) {
event.alpha = 0;
event.beta = 0;
event.gamma = 0;
}, false);
Screen Orientation API
screen.orientation.addEventListener('change', function() {
screen.orientation.type = "landscape-primary";
screen.orientation.angle = 0;
}, false);
Window Orientation
window.addEventListener("orientationchange", function() {
screen.orientation.angle = ;
}, false);
CSS Mediaqueries
@media screen and (orientation:portrait) {
/* styles spécifiques à l'orientation portrait */
}
@media screen and (orientation:landscape) {
/* styles spécifiques à l'orientation paysage */
}
var mediaQueryList = window.matchMedia("(orientation: portrait)");
mediaQueryList.addListener(function(mql) {
mql.matches = ;
});