<FAQENTRY>4.9 code change</FAQENTRY>

V

VK

As per recent discussion at mozilla.dev.tech.javascript
"Scrollbars not being taken into account with JavaScript"
http://groups.google.com/group/mozilla.dev.tech.javascript/browse_frm/thread/a299e61021b97eb9

I do agree with the OP that while saying "canvas" it is not assumed
"available space plus scrollbars" but "available space for placing
elements so minus any scrollbars"

This way I consider the code at
"4.9 How do I find the size of the window/browser canvas area?"
http://www.jibbering.com/faq/index.html#FAQ4_9
if not defective then at least misleading in many circumstances (with
innerWidth block executed) where the results are not what promised by
the FAQ title.

Before proposing code fixes I wondering if there is common agreement
on the issue to exist.
 
S

Stevo

VK said:
As per recent discussion at mozilla.dev.tech.javascript
"Scrollbars not being taken into account with JavaScript"
http://groups.google.com/group/mozilla.dev.tech.javascript/browse_frm/thread/a299e61021b97eb9

I do agree with the OP that while saying "canvas" it is not assumed
"available space plus scrollbars" but "available space for placing
elements so minus any scrollbars"

This way I consider the code at
"4.9 How do I find the size of the window/browser canvas area?"
http://www.jibbering.com/faq/index.html#FAQ4_9
if not defective then at least misleading in many circumstances (with
innerWidth block executed) where the results are not what promised by
the FAQ title.

Before proposing code fixes I wondering if there is common agreement
on the issue to exist.

My canvas calculating code incorporates scrollbar size determination.
It's essential for the Mozilla family. I incorporated the temporary
nested DIV's with overflow code that some kind person came up with and
published out there. Without it, anything that wants to justify itself
to the right (or be horizontally centered) would be in the wrong place.
 
V

VK

My canvas calculating code incorporates scrollbar size determination.
It's essential for the Mozilla family. I incorporated the temporary
nested DIV's with overflow code that some kind person came up with and
published out there. Without it, anything that wants to justify itself
to the right (or be horizontally centered) would be in the wrong place.

Can you propose this code for public domain and publish it in this
thread for consideration?
 
D

David Mark

As per recent discussion at mozilla.dev.tech.javascript
"Scrollbars not being taken into account with JavaScript"http://groups.google.com/group/mozilla.dev.tech.javascript/browse_frm...

I do agree with the OP that while saying "canvas" it is not assumed
"available space plus scrollbars" but "available space for placing
elements so minus any scrollbars"

The innerWidth/Height properties include scrollbars. AFAIK, that has
always been the case.
This way I consider the code at
"4.9 How do I find the size of the window/browser canvas area?"http://www.jibbering.com/faq/index.html#FAQ4_9
if not defective then at least misleading in many circumstances (with
innerWidth block executed) where the results are not what promised by
the FAQ title.

We went over that a few months back. The FAQ entry should be updated
to note that the dimensions may include scrollbars.
Before proposing code fixes I wondering if there is common agreement
on the issue to exist.

There are at least two solutions out there that address this issue.
Richard Cornford's "Russian Doll" version, which also calculates the
scroll position, is very efficient and well documented, but too long
for a FAQ entry. A less efficient (and largely undocumented) solution
can be found in this project:

http://code.google.com/p/niceshowcase/

This one also accounts for borders and margins on the outermost
element (body or documentElement), which affect the calculations in
some browsers. I have recently rewritten some of the code to make it
easier to follow and will add the updated version to the CWR project
when I get a chance.
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top