1. #1
    Sencha User
    Join Date
    Apr 2012
    Location
    Toronto, Canada
    Posts
    6
    Vote Rating
    1
    jackson7 is on a distinguished road

      0  

    Default How to get Screen / Device width and Height

    How to get Screen / Device width and Height


    Hello everyone,

    I am developing an App using Sencha Touch 2. I am trying to find out the device/screen width and height, but I can't seem to figure it out. I have tried using:

    Code:
    Ext.Viewport.getWidth();
    which returns 100%. However, I would need to know the width/height in pixels. I need to embed a video, and I need to maintain aspect ratio for different device resolutions.

    There's the traditional Javascript approach:

    Code:
    var width = (window.innerWidth > 0) ? window.innerWidth : screen.width;
    which seems to work fine, but I would like to know the proper way to do it in Sencha Touch 2.

    Any Help would be appreciated.


    Thanks,

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,677
    Vote Rating
    749
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    There is nothing wrong with getting the size off the window.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Location
    Toronto, Canada
    Posts
    6
    Vote Rating
    1
    jackson7 is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    There is nothing wrong with getting the size off the window.
    Thanks!

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar