Results 1 to 4 of 4

Thread: Phone or tablet-specific style sheet

  1. #1
    Sencha User
    Join Date
    Mar 2007
    Posts
    443
    Answers
    5
    Vote Rating
    18
      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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      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
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    443
    Answers
    5
    Vote Rating
    18
      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
  •