arne Posted June 15, 2006 Share Posted June 15, 2006 I want to set different CSS, based on a user's screen width (eg one stylesheet for 800px width, one for 1024px width, and so on). I do NOt want the user to choose, this should be done automatically when loading the page. How to? Can't seem to find an answer on the net, only for form triggered stylesheet switchers and that is not what I am looking for.Maybe this should be in JavaScript forum? Link to comment Share on other sites More sharing options...
S@m Posted June 15, 2006 Share Posted June 15, 2006 Yep. JavaScript could detect screen resolution. I'm not one to help with the actual code though. Better ask somone who knows what they are talking about. Link to comment Share on other sites More sharing options...
scott100 Posted June 15, 2006 Share Posted June 15, 2006 Use javascript to dertermine the screen dimenstions then based on the values display the appropriate stylesheet.I think i have this lying around somewhere, i'll try dig it out later on. Link to comment Share on other sites More sharing options...
S@m Posted June 15, 2006 Share Posted June 15, 2006 Ha!I must have hit submit a split second before you scott Link to comment Share on other sites More sharing options...
arne Posted June 15, 2006 Author Share Posted June 15, 2006 Use javascript to dertermine the screen dimenstions then based on the values display the appropriate stylesheet.Yes, I came to that conclusion, too.I think i have this lying around somewhere, i'll try dig it out later on. That'd be great! I tried to do it myself but my JavaScript knowledge is close to 0 and too busy to dive into it... much appreciated! Link to comment Share on other sites More sharing options...
scott100 Posted June 15, 2006 Share Posted June 15, 2006 Ok here it is, i won't bore you with how it works All you need to know is that there are 3 stylesheets, low, medium and high, each one obviously relates to that resolution. Change these anyway you like.Preview and download the files from here.http://scott100.atspace.com/switcher.htmIf for some reason the browser has javascript disabled it will default to the low.css stylesheet.Any questions give me a shout :)plus it works in IE, FF and Opera Link to comment Share on other sites More sharing options...
arne Posted June 16, 2006 Author Share Posted June 16, 2006 Ok here it is, i won't bore you with how it works All you need to know is that there are 3 stylesheets, low, medium and high, each one obviously relates to that resolution. Change these anyway you like.Preview and download the files from here.http://scott100.atspace.com/switcher.htmIf for some reason the browser has javascript disabled it will default to the low.css stylesheet.Any questions give me a shout :)plus it works in IE, FF and Opera <{POST_SNAPBACK}> you are the best! thank you so much! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now