Set device orientation to landscape via css / js / html?

Possible duplicate:
Mobile site - only forced landscape / without automatic rotation

I saw several posts about this, but actually did not find a definitive answer, but a few suggested workarounds.

Can I force device orientation through a web page? Ie: Can I hush my site like landscape?

Many thanks

+5
source share
1 answer

You can use javascript. First check if it is supported:

if (window.DeviceOrientationEvent) {
    console.log("DeviceOrientation is supported");
}

Then add an eventListener if you want to do something on rotation:

window.addEventListener('deviceorientation', function(eventData) {});

, , . , . , , ( css?), , , CSS JavaScript (jQuery ).

, , , GET, , , , . JavaScript , iPhone. JavaScript CPU, , , . - HTML5- JavaScript. IPhone , App: P.

+3

All Articles