1. #1
    Sencha User
    Join Date
    Mar 2007
    Posts
    416
    Vote Rating
    18
    Answers
    5
    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
    Gainesville, FL
    Posts
    37,548
    Vote Rating
    873
    Answers
    3566
    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


    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
    ________________
    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
    Mar 2007
    Posts
    416
    Vote Rating
    18
    Answers
    5
    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.

  4. #4
    Sencha Premium Member
    Join Date
    May 2013
    Location
    Brooklyn
    Posts
    6
    Vote Rating
    0
    kodevka is on a distinguished road

      0  

    Default


    Is this possible now ? Can we load stylesheets according to profiles that respect device, orientation etc ?

Thread Participants: 2

Tags for this Thread