469,327 Members | 1,242 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,327 developers. It's quick & easy.

Detect if overflow required

I am toying with a javascript scrollbar for a DIV, and am trying to
make it as accessible as possible, I have succeeded on the most part,
but there is a slight problem due to the fact that it isn't a real
scrollbar, I believe the best way is to detect whether overflow is
required, then have it display the newscrollbar and hide the old one!

Anybody have any ideas on whether this is possible, was previously
trying to get style.height, but was not getting any value for the
resizeable box as nothing had been declared, it was resized via text.

Cheers for any help you may be able to give.

Dan Duke

Aug 14 '07 #1
9 3532
wrote on 14 aug 2007 in comp.lang.javascript:
I am toying with a javascript scrollbar for a DIV, and am trying to
make it as accessible as possible, I have succeeded on the most part,
but there is a slight problem due to the fact that it isn't a real
scrollbar, I believe the best way is to detect whether overflow is
required, then have it display the newscrollbar and hide the old one!

Anybody have any ideas on whether this is possible, was previously
trying to get style.height,
try element.offsetHeight
but was not getting any value for the
resizeable box as nothing had been declared, it was resized via text.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 14 '07 #2
On Aug 14, 4:21 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
wrote on 14 aug 2007 in comp.lang.javascript:
I am toying with a javascript scrollbar for a DIV, and am trying to
make it as accessible as possible, I have succeeded on the most part,
but there is a slight problem due to the fact that it isn't a real
scrollbar, I believe the best way is to detect whether overflow is
required, then have it display the newscrollbar and hide the old one!
Anybody have any ideas on whether this is possible, was previously
trying to get style.height,

try element.offsetHeight
but was not getting any value for the
resizeable box as nothing had been declared, it was resized via text.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
awesome, that seemed to do the job perfectly, the only problem is that
it doesn't pick up when the user changes the font size in the browser,
is there a way to get a javascript function to run when the user does
this?

Cheers for your help

Dan

Aug 16 '07 #3
re*******@googlemail.com wrote on 16 aug 2007 in comp.lang.javascript:
On Aug 14, 4:21 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
> wrote on 14 aug 2007 in comp.lang.javascript:
I am toying with a javascript scrollbar for a DIV, and am trying to
make it as accessible as possible, I have succeeded on the most part,
but there is a slight problem due to the fact that it isn't a real
scrollbar, I believe the best way is to detect whether overflow is
required, then have it display the newscrollbar and hide the old one!
Anybody have any ideas on whether this is possible, was previously
trying to get style.height,

try element.offsetHeight
but was not getting any value for the
resizeable box as nothing had been declared, it was resized via text.
[Please do not quoote signatures on usenet]
>
awesome, that seemed to do the job perfectly, the only problem is that
it doesn't pick up when the user changes the font size in the browser,
is there a way to get a javascript function to run when the user does
this?
Just specify fixed font.
[Beware the wrath of the CSS gurus.]

<style type='text/css'>
body {font-size:14pt;}
</style>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 16 '07 #4
On Aug 16, 10:35 am, "Evertjan." <exjxw.hannivo...@interxnl.net>
wrote:
retrod...@googlemail.com wrote on 16 aug 2007 in comp.lang.javascript:
On Aug 14, 4:21 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
wrote on 14 aug 2007 in comp.lang.javascript:
I am toying with a javascript scrollbar for a DIV, and am trying to
make it as accessible as possible, I have succeeded on the most part,
but there is a slight problem due to the fact that it isn't a real
scrollbar, I believe the best way is to detect whether overflow is
required, then have it display the newscrollbar and hide the old one!
Anybody have any ideas on whether this is possible, was previously
trying to get style.height,
try element.offsetHeight
but was not getting any value for the
resizeable box as nothing had been declared, it was resized via text.

[Please do not quoote signatures on usenet]
awesome, that seemed to do the job perfectly, the only problem is that
it doesn't pick up when the user changes the font size in the browser,
is there a way to get a javascript function to run when the user does
this?

Just specify fixed font.
[Beware the wrath of the CSS gurus.]

<style type='text/css'>
body {font-size:14pt;}
</style>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Users can still alter the text size even if font-size is set. For
example in firefox you just hold down ctrl and move the mouses scroll
wheel to increase/decrease the font-size.

So sadly this wont get around my problem in the long term! Any other
ideas please.

Dan

Aug 16 '07 #5
re*******@googlemail.com wrote on 16 aug 2007 in comp.lang.javascript:
but was not getting any value for the
resizeable box as nothing had been declared, it was resized via
text.

[Please do not quoote signatures on usenet]
awesome, that seemed to do the job perfectly, the only problem is
that it doesn't pick up when the user changes the font size in the
browser, is there a way to get a javascript function to run when
the user does this?

Just specify fixed font.
[Beware the wrath of the CSS gurus.]

<style type='text/css'>
body {font-size:14pt;}
</style>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Why do you think I wrote this?
>[Please do not quoote signatures on usenet]
Users can still alter the text size even if font-size is set. For
example in firefox you just hold down ctrl and move the mouses scroll
wheel to increase/decrease the font-size.

So sadly this wont get around my problem in the long term! Any other
ideas please.
No, your problem seeme to be, that you expect html on different browsers
and different browser settings to show exactly the same correct picture.

That is not what html and the www is about, you should expect a
reasonable nice view on the majority of browsers, standard settings and
standard available fonts, and so also a reasonable javascript effext on
view manipulation.
... in the long term ...
I don't know what you mean by that n this case.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 16 '07 #6
re*******@googlemail.com wrote:
[...] "Evertjan." [...] wrote:
>retrod...@googlemail.com wrote on 16 aug 2007 in comp.lang.javascript:
>>On Aug 14, 4:21 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
wrote on 14 aug 2007 in comp.lang.javascript:
I am toying with a javascript scrollbar for a DIV, and am trying to
awesome, that seemed to do the job perfectly, the only problem is that
it doesn't pick up when the user changes the font size in the browser,
is there a way to get a javascript function to run when the user does
this?
Just specify fixed font.
[Beware the wrath of the CSS gurus.]
It isn't wrath, it is merely complete incomprehension how someone could post
such a nonsense *knowlingly*.
><style type='text/css'>
body {font-size:14pt;}
That font size will be different among computers because the `pt' size is
defined by the font resolution which in turn is defined by the display
resolution which is defined by the capabilities of the underlying graphics
hardware and of the GUI. And, as the OP observed, pt-sized fonts can be
scaled everywhere.

px-sized fonts cannot be scaled per menu in Internet Explorer 6. However,
since the actual pixel size depends directly on display resolution (which
can render the px-sized font illegible as well), it is not a unit
recommended for screen fonts.

It is common knowledge that font sizes for the screen should be specified
using the units `em' or `%', with 1em = 100% being relative to the font-size
of the next font-size formatted ancestor element, or to the default user
stylesheet.
></style>
[...]
Please trim your quotes as you already have been asked to.
Users can still alter the text size even if font-size is set. For
example in firefox you just hold down ctrl and move the mouses scroll
wheel to increase/decrease the font-size.
Or press Ctrl+[+-].
So sadly this wont get around my problem in the long term! Any other
ideas please.
Since there is no cross-browser event for scaling fonts, it would appear
that you are out of luck.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>
Aug 16 '07 #7
Thomas 'PointedEars' Lahn wrote on 16 aug 2007 in comp.lang.javascript:
re*******@googlemail.com wrote:
>[...] "Evertjan." [...] wrote:
>>retrod...@googlemail.com wrote on 16 aug 2007 in
comp.lang.javascript:
On Aug 14, 4:21 pm, "Evertjan." <exjxw.hannivo...@interxnl.net>
wrote:
wrote on 14 aug 2007 in comp.lang.javascript:
>I am toying with a javascript scrollbar for a DIV, and am trying
>to
awesome, that seemed to do the job perfectly, the only problem is
that it doesn't pick up when the user changes the font size in the
browser, is there a way to get a javascript function to run when
the user does this?
Just specify fixed font.
[Beware the wrath of the CSS gurus.]

It isn't wrath, it is merely complete incomprehension how someone
could post such a nonsense *knowlingly*.
>><style type='text/css'>
body {font-size:14pt;}

That font size will be different among computers because the `pt' size
is defined by the font resolution which in turn is defined by the
display resolution which is defined by the capabilities of the
underlying graphics hardware and of the GUI. And, as the OP observed,
pt-sized fonts can be scaled everywhere.
Oh, dear pointed, when do you start to be all ears to the problem first,
so that your often to the point[ed] remarks would hit the mark?

The absolute measures of the points, pointed, are not important here,
only that they do not change with simple browser size changing
AFTER page completion and offsetHeight detection.

This would help under IE, but less so in other browsers.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 16 '07 #8
Cheers, guys, a friend has just suggested another idea, and that is to
watch offsetHeight, so I would need to set up an eventListener, so
that as offsetHeight changes, it runs a function. Sorry about the
newby questions, but any help would be much appreciated.

Dan

Aug 17 '07 #9
re*******@googlemail.com wrote on 17 aug 2007 in comp.lang.javascript:
Cheers, guys, a friend has just suggested another idea, and that is to
watch offsetHeight, so I would need to set up an eventListener, so
that as offsetHeight changes, it runs a function. Sorry about the
newby questions, but any help would be much appreciated.
[please always quote on usenet]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 17 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by John Black | last post: by
3 posts views Thread by andrew.neale | last post: by
2 posts views Thread by Robert McEuen | last post: by
5 posts views Thread by ip4ram | last post: by
27 posts views Thread by REH | last post: by
reply views Thread by Marco Segurini | last post: by
4 posts views Thread by mhart | last post: by
30 posts views Thread by Angel Tsankov | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.