Well, you could do this by writing each line to the browser in a separate Ajax request, using JavaScript on the client to tell you when no more lines will fit. This seems like a lot of work and drag on your server for very limited benefit. Aesthetics aside, are you designing for a device that is intentionally crippled by removing its ability to scroll?

Walter

On Jun 2, 2011, at 1:44 AM, [email protected] wrote:

Rather than displaying a fixed number of lines of text (e.g. 30), I'd
like to dynamically fill the browser window with as many
lines as it will display without scrolling.


On Jun 1, 6:53 pm, Walter Davis <[email protected]> wrote:
On Jun 1, 2011, at 8:31 PM, [email protected] wrote:

If I'm displaying lines of text (e.g. list of records from a
database), how can I determine how many lines will fit in the browser
window?

Does javascript have the equivalent of SIGWINCH?

Generally speaking, no. Web pages tend to grow to whatever height
their content requires, and even if you could get the current window
height from the browser, you would still need to send that information
back to the browser (maybe through an Ajax request) even then, you
still wouldn't know about the browser's font settings or other user
preferences that could influence how many lines of text would fit in
the current window size. Never mind what happens when the visitor
resizes her window.

What's your goal here? Are you trying to enforce a "no scroll bars"
aesthetic or something?

Walter





Thanks,

Joe

--
You received this message because you are subscribed to the Google
Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-
[email protected].
To unsubscribe from this group, send email to 
[email protected]
.
For more options, visit this group 
athttp://groups.google.com/group/rubyonrails-talk?hl=en
.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails- [email protected]. To unsubscribe from this group, send email to [email protected] . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en .


--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to