Re: <FAQENTRY>4.9 code change</FAQENTRY>
- From: David Mark <dmark.cinsoft@xxxxxxxxx>
- Date: Sun, 10 Feb 2008 19:34:15 -0800 (PST)
On Feb 10, 4:42 am, VK <schools_r...@xxxxxxxxx> wrote:
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.
.
- References:
- <FAQENTRY>4.9 code change</FAQENTRY>
- From: VK
- <FAQENTRY>4.9 code change</FAQENTRY>
- Prev by Date: Crockford's Prototypal Inheritance Function
- Next by Date: Re: Crockford's Prototypal Inheritance Function
- Previous by thread: Re: <FAQENTRY>4.9 code change</FAQENTRY>
- Next by thread: Access Denied error in IE6 when try to access to a IFRAME without src
- Index(es):
Relevant Pages
|