javascript - initial window.orientation always 0 on Windows Phone -


i'm trying detect device orientation on website.

orientation value seems ok after orientationchange event.

$(window).on("orientationchange",function(event){alert(window.orientation);})  

however problem initial window.orientation value @ page startup 0 when device in landscape position.

$(document).ready(function(){alert(window.orientation);}); 

it doesn't change after delay (i've checked that) changes right value after orientationchange event.

is there way proper orientation @ page startup?

it looks property isn't supported in other chrome android: https://developer.mozilla.org/en-us/docs/web/api/screen/orientation

depending on want use css rules?

@media screen , (max-width: 999px) {   /* rules apply canvases narrower 1000px */ }  @media screen , (device-width: 768px) , (orientation: landscape) {   /* rules ipad in landscape orientation */ }  @media screen , (min-device-width: 320px) , (max-device-width:    480px) {   /* iphone, android rules here */ } 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -