You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Sergey Grebnov (JIRA)" <ji...@apache.org> on 2014/07/09 15:56:04 UTC

[jira] [Commented] (CB-2100) Window size issue when the orientation is changed

    [ https://issues.apache.org/jira/browse/CB-2100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14056242#comment-14056242 ] 

Sergey Grebnov commented on CB-2100:
------------------------------------

Confirm this behavior, but not sure we can do anything here.

As a workaround:

The following could properties could be used instead.
document.body.clientHeight 
document.body.clientWidth

Also, you can use window.orientation to manually swap screen.width/height when you do your calculation.

if window.orientation does not work you can detect it as this.orientation = window.innerHeight >= window.innerWidth ? 'portrait' : 'landscape';

> Window size issue when the orientation is changed
> -------------------------------------------------
>
>                 Key: CB-2100
>                 URL: https://issues.apache.org/jira/browse/CB-2100
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: WP8
>    Affects Versions: 2.2.0, 2.3.0
>         Environment: Windows 8 - Visual Studio 2012 - Windows Phone 8 SDK
>            Reporter: Guillaume Charhon
>            Assignee: Jesse MacFadyen
>            Priority: Minor
>         Attachments: Test.zip
>
>
> The change of the orientation of the phone in the MainPage.xaml 
> (by setting the SupportedOrientations="Landscape" Orientation="Landscape" attributes) do not have any impact of the html window size.
> This code snippet displays portrait values instead of landscape values : 
> var height = screen.height;
> var width = screen.width;
> alert("height : " + height);
> alert("width : " + width);
> This behavior does not occurs on iOS, Android, etc.
> I have not tried on Windows Phone 7.
> I have attached a sample project to this bug report.



--
This message was sent by Atlassian JIRA
(v6.2#6252)