Detect if overflow required

R

retrodans

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
 
E

Evertjan.

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
 
R

retrodans

wrote on 14 aug 2007 in comp.lang.javascript:



try element.offsetHeight

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
 
E

Evertjan.

[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>
 
R

retrodans

(e-mail address removed) wrote on 16 aug 2007 in comp.lang.javascript:



[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>

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
 
E

Evertjan.

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>

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.
 
T

Thomas 'PointedEars' Lahn

(e-mail address removed) wrote on 16 aug 2007 in comp.lang.javascript:
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*.

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.

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
 
E

Evertjan.

Thomas 'PointedEars' Lahn wrote on 16 aug 2007 in comp.lang.javascript:
(e-mail address removed) wrote on 16 aug 2007 in
comp.lang.javascript:
On Aug 14, 4:21 pm, "Evertjan." <[email protected]>
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*.

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.
 
D

Dr J R Stockton

In comp.lang.javascript message <1187256306.674217.47820@57g2000hsv.
googlegroups.com>, Thu, 16 Aug 2007 02:25:06, "(e-mail address removed)"
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?


You can provide controls on the page for resizing the text, together
with words to encourage their use. To get started, consider

<input type=text ID=XQ1 size=10 value="85%">
<input type=button value="Set"
onClick="document.body.style.fontSize=document.getElementById('XQ1').value">

but you may prefer buttons for increase, decrease, and restore.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.
 
R

retrodans

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
 
E

Evertjan.

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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top