1
Bassman
CSS guru help required - screen resolution
  • 2004/8/18 2:34

  • Bassman

  • Friend of XOOPS

  • Posts: 1272

  • Since: 2003/5/23


OK, here's a question for all the CSS gurus out there.

I'm trying to make a theme that chooses a style sheet based on screen resolution. I found a little javascript that could be adapted to choose the correct resolution, but how will it know if it's a style.css or styleNN.css file?

Quote:

<script language="Javascript">
if (screen.width < 1024) {
document.write('<link rel=stylesheet type="text/css" href="lowFonts.css">');
}
if (screen.width >= 1024 && screen.width < 1280) {
document.write('<link rel=stylesheet type="text/css" href="mediumFonts.css">');
}
if (screen.width >= 1280) {
document.write('<link rel=stylesheet type="text/css" href="highFonts.css">');
}
</script>


The above chooses a particular style sheet for different size fonts, but it should work ok for what I have in mind :)

Any ideas?

2
tjnemez
Re: CSS guru help required - screen resolution
  • 2004/8/18 2:53

  • tjnemez

  • Home away from home

  • Posts: 1594

  • Since: 2003/9/21


you need a java guru bassman. personally i would not consider the styleNN, i would just test theme with all browsers (i.e. tabsmod allows users to select text size using only style.css for each size).

3
Bassman
Re: CSS guru help required - screen resolution
  • 2004/8/18 4:27

  • Bassman

  • Friend of XOOPS

  • Posts: 1272

  • Since: 2003/5/23


OK, my theme works without styleNN.css. All good. Now, I have the following in my theme.html:
Quote:

<script type="text/javascript" language="javascript">
if (screen.width <= 800) {
document.write('<link rel=stylesheet type="text/css" href="<{$xoops_imageurl}>style.css">');
}
if (screen.width => 1024 {
document.write('<link rel=stylesheet type="text/css" href="<{$xoops_imageurl}>style1024.css">');
}

</script>


and style.css and style1024.css in my theme folder, but i'm getting no css rendering of my page - just white background with the text of my page on it.

Javascript gurus anyone?? :)

4
Bassman
Re: CSS guru help required - screen resolution
  • 2004/8/18 6:18

  • Bassman

  • Friend of XOOPS

  • Posts: 1272

  • Since: 2003/5/23


OK-Fixed :)

5
tjnemez
Re: CSS guru help required - screen resolution
  • 2004/8/18 18:03

  • tjnemez

  • Home away from home

  • Posts: 1594

  • Since: 2003/9/21


this theme you are working on, is it on your site?

6
Bassman
Re: CSS guru help required - screen resolution
  • 2004/8/18 21:50

  • Bassman

  • Friend of XOOPS

  • Posts: 1272

  • Since: 2003/5/23


I have a previous version on my site - it's the nwn theme. It's been done for a request. The only difference is the new version has 2 style sheets. One for up to 800 x 600 and another for 1024 x 768 and above. Both are fixed width.

7
Bassman
Re: CSS guru help required - screen resolution
  • 2004/8/18 23:35

  • Bassman

  • Friend of XOOPS

  • Posts: 1272

  • Since: 2003/5/23


OK the current version is now on my site. Works well too :)

Login

Who's Online

221 user(s) are online (167 user(s) are browsing Support Forums)


Members: 0


Guests: 221


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits