Determining width of viewing window

Does Rails provide a means for determining the width of the viewing
area? What I’d like to do is to be able to say something like,
‘style=“width: 100%-140px”’. Thanks.

   ... doug

that’s a server side issue, so it’s not as much as Rails issue as a
Javascript issue. And as far as I know, Rails doesn’t have any helpers
for
that kind of function. Try looking around for the terms javascript and
window.width. that should get you started…

On 4/12/07, doug [email protected] wrote:


Mike W.
Web D.
UW-Eau Claire

On 12 Apr 2007, at 19:54, doug wrote:

Does Rails provide a means for determining the width of the viewing
area? What I’d like to do is to be able to say something like,
‘style=“width: 100%-140px”’. Thanks.

The width of a viewing area is a clientside thing, Rails is a
serverside framework. You need to look into Prototype (a JavaScript
framework), which has functions to handle this kind of thing. I can
recommend the “Prototype & Scriptaculous in Action” book from Manning
as well as the prototype API on Position: http://prototypejs.org/api/
position

A google search should also bring up a couple of things.

Best regards

Peter De Berdt

Thanks to all. With the help I obtained, I got it working. The point
about the dimensions of the viewing area being a client-side thing is
well taken. Thanks again.

   ... doug