Re: [Rails] Javascript Q: Is there a way to determine the # of lines of text that will fit on a page?
On Jun 1, 2011, at 8:31 PM, joe@via.net 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-
> talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com
> .
> 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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home