joe-d+mcHS0gSOY@public.gmane.org
2011-Jun-02 00:31 UTC
Javascript Q: Is there a way to determine the # of lines of text that will fit on a page?
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? 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Walter Davis
2011-Jun-02 01:53 UTC
Re: 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-d+mcHS0gSOY@public.gmane.org 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
joe-d+mcHS0gSOY@public.gmane.org
2011-Jun-02 05:44 UTC
Re: Javascript Q: Is there a way to determine the # of lines of text that will fit on a page?
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 <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote:> On Jun 1, 2011, at 8:31 PM, j...-d+mcHS0gSOY@public.gmane.org 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > . > > 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
ratnadeepdeshmane-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2011-Jun-02 07:48 UTC
Re: Re: Javascript Q: Is there a way to determine the # of lines of text that will fit on a page?
You may do that with css. Suppose you have a div with some text content, then give it a class as noScorll and define it as - .noScroll{ overflow:hide; } Details here - http://www.w3schools.com/css/pr_pos_overflow.asp <http://www.w3schools.com/css/pr_pos_overflow.asp> On Thu, Jun 2, 2011 at 11:14 AM, joe-d+mcHS0gSOY@public.gmane.org <joe-d+mcHS0gSOY@public.gmane.org> 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 <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: > > On Jun 1, 2011, at 8:31 PM, j...-d+mcHS0gSOY@public.gmane.org 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > > . > > > 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-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- Ratnadeep Deshmane. http://rtdptech.com -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Walter Davis
2011-Jun-02 13:21 UTC
Re: Re: Javascript Q: Is there a way to determine the # of lines of text that will fit on a page?
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, joe-d+mcHS0gSOY@public.gmane.org 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 <wa...-HQgmohHLjDZWk0Htik3J/w@public.gmane.org> wrote: >> On Jun 1, 2011, at 8:31 PM, j...-d+mcHS0gSOY@public.gmane.org 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>> To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >>> . >>> 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- > talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
bacrossland
2011-Jun-02 13:27 UTC
Re: Javascript Q: Is there a way to determine the # of lines of text that will fit on a page?
On Jun 1, 7:31 pm, "j...-d+mcHS0gSOY@public.gmane.org" <j...-d+mcHS0gSOY@public.gmane.org> 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? > > Thanks, > > JoeI fail to see what this question has to do with Rails. I know people here have given you some ideas but you might get more from a Javascript group than a Rails group on this question. B. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.