Determining screen size and/or resolution?

What’s the easiest or best way to determine the screen size from within
a controller or view in Rails? My “divs” look great at 1280x800, but
not so hot on 800x600. I want to dynamically alter the layout based on
the resolution. Any hints regarding screen size or alternate ways of
handling this issue would be appreciated.

Thanks!

I would suggest not trying to find out, but instead learning how to
design your CSS stylesheets to be independant of screen size.

I’m not really good at layout design, but the book “Cascading Style
Sheets (3rd ed)” by Hakon Wium Lie and Bert Bos was helpful to me.

Maybe try here:

Google may help find good tutorials.

Good Luck,

Sean

Nathan L. wrote:

What’s the easiest or best way to determine the screen size from within
a controller or view in Rails? My “divs” look great at 1280x800, but
not so hot on 800x600. I want to dynamically alter the layout based on
the resolution. Any hints regarding screen size or alternate ways of
handling this issue would be appreciated.

Thanks!

There isn’t a reliable way to do this. You’d do it with javascript to
get
the objects width and height, but just about every browser and browser
revision has changed the way this is accomplished. Look into javascript
and
see what you can find.

Good luck with it

I was thinking about this too. Sometimes you need to know the screen
size so that your site can look its best at all resolutions.

I would recommend having one CSS file per screen size, and loading the
appropriate one using JavaScript. Dave Shea mentions this approach near
the end of this podcast: http://www.thinkvitamin.com/interviews/css/
dave-shea/. He mentions a JS library that does this for him, but I
don’t have the link.

HTH.

On Wednesday, April 19, 2006, at 10:00 PM, sean lynch wrote:

Thanks!


Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Cheers!
–Dave T.
http://devlists.com - Email list management
http://palmsphere.com - Apps for your hand-held