List Info

Thread: How to determine if an element has a scrollbar?




How to determine if an element has a scrollbar?
user name
2006-11-21 00:47:17
Cheers,

I have a div that has the `overflow: auto;` style and that
gets its 
content periodically updated by AJAX. In order to adjust
some styles I 
need to know if the div has the scrollbar present.

Does anybody know how to determine this?


Thanks,
Jonathan

-- 
Jonathan Weiss
http://blog.innerewut.de


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

How to determine if an element has a scrollbar?
user name
2006-11-21 03:20:28
Jonathan Weiss wrote:

> I have a div that has the `overflow: auto;` style and
that gets its 
> content periodically updated by AJAX. In order to
adjust some styles I 
> need to know if the div has the scrollbar present.
> 
> Does anybody know how to determine this?

Try:

var has_scroll = (element.scrollHeight !=
element.clientHeight);

-- 
We develop, watch us RoR, in numbers too big to ignore.


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

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )