Results 1 to 4 of 4

Thread: Phone or tablet-specific style sheet

  1. #1
    Sencha User
    Join Date
    Mar 2007
    Posts
    447
    Answers
    5
    Vote Rating
    19
      0  

    Default 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 User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,062
    Answers
    3976
    Vote Rating
    1390
      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 @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    447
    Answers
    5
    Vote Rating
    19
      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
      0  

    Default

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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •