1. #1
    Sencha User
    Join Date
    Mar 2007
    Posts
    334
    Vote Rating
    15
    Answers
    4
    jweber will become famous soon enough

      0  

    Default Unanswered: Phone or tablet-specific style sheet

    Unanswered: Phone or tablet-specific style sheet


    Using Sencha Touch, is it possible to load certain CSS files only when the device is a phone, or only when it's a tablet?

    I know I can use the "x-phone" and "x-tablet" classes that are applied to the <body> tag, and I can use @media queries, but both of those require both style sheets to be loaded on either device. Since the device won't change once the app is loaded, I would prefer to just load one style sheet.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,117
    Vote Rating
    454
    Answers
    3159
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Well you should be adding them to the app cache but there isn't a way to do that in app.json (in 2.2 you can for platforms but not profiles). So what you could do is add your own <link> element to the <head> dependent on which profile device belongs to.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    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 almost in print!

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

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    334
    Vote Rating
    15
    Answers
    4
    jweber will become famous soon enough

      0  

    Default


    Thanks. I think it would be a useful addition to Sencha Cmd, that it allow you to specify a "media" query for each CSS file. If there are files with different media queries, it could generate separate <link> tags for each query, and give them the appropriate "media" attribute.

Tags for this Thread