473,386 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 3686
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John Black | last post by:
Hi, If I have many integer calculation in my code, what's the best way to detect integer overflow? unsigned int i1 = 0xFFFFFF00, i2 = 0xFFFF; then in statement unsigned int i3 = i1 + i2;...
3
by: andrew.neale | last post by:
Hello, I have a div that has an overflow set to auto. I would like to know if the scrollbars are visible in javascript. Any help is appreciated. Thanks
2
by: Robert McEuen | last post by:
Using Access 97, Windows XP I'm receiving a Numeric Field Overflow error during text import that I did not receive before I split my database. Another thread I found suggested that the cause of...
5
by: ip4ram | last post by:
I am quite puzzled by the stack overflow which I am encountering.Here is the pseudocode //define stack structure //function operating on stack void my_stack_function( function parameters) {...
27
by: REH | last post by:
I asked this on c.l.c++, but they suggested you folks may be better able to answer. Basically, I am trying to write code to detect overflows in signed integer math. I am trying to make it as...
0
by: Marco Segurini | last post by:
Hi, I am trying to dynamically install/deinstall a message handler to a System.Windows.Forms.Form using NativeWindow. I do not use IMessageFilter derived class because it intercept only the...
2
by: jay | last post by:
I am attempting to impersonate an account in ASPNET. I am using aspnet_setreg to store the username and passwords. I have given the ASPNET account permisision to read the registry values. However,...
4
by: mhart | last post by:
I'm using a fixed width <DIV> with the following CSS style assigned: text-overflow:ellipsis; overflow:hidden; Does anyone know how, using Javascript, to detect whether the <DIV> has...
30
by: Angel Tsankov | last post by:
Hello! Does the C++ standard define what happens when the size argument of void* operator new(size_t size) cannot represent the total number of bytes to be allocated? For example: struct S {...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.