I have some kind of app, where interface depends on orientation change. So I have two functions for interface portraitSet()
and landscapeSet()
. Here is the code how I catching up orientation change event:
$(window).on("orientationchange",function(event){
alert(event.orientation);
if (event.orientation == 'portrait')
{
$(portraitSet());
}
else if (event.orientation == 'landscape')
{
$(landscapeSet());
}
});
On launch app in portrait mode it works perfectly, but when start app in landscape mode and trying to set mobile into portrait mode my alert(event.orientation)
giving me message "landscape", but mobile on portrait mode. Where is my mistake?