Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="ISO-8859-1" Message-ID: <1529063.40VBb9nUPl@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Sun, 13 Nov 2011 04:31:57 +0100 User-Agent: KNode/4.4.11 Content-Transfer-Encoding: 7Bit Subject: Re: David Mark's Javascript Tip Du Jour - Volume #1 - Tip #1234 - How to Measure Element Dimensions Newsgroups: comp.lang.javascript References: Followup-To: comp.lang.javascript MIME-Version: 1.0 Lines: 37 NNTP-Posting-Date: 13 Nov 2011 04:31:57 CET NNTP-Posting-Host: 7dcd4939.newsspool3.arcor-online.net X-Trace: DXC=m4\Wf]Adk4GI7\_^6>c20JMcF=Q^Z^V3H4Fo<]lROoRA8kFWCAYIl[G:om<7N X-Complaints-To: usenet-abuse@arcor.de Xref: x330-a1.tempe.blueboxinc.net comp.lang.javascript:8275 J.R. wrote: > On 10/11/2011 12:09, David Mark wrote: >> if (document.documentElement&& typeof >> document.documentElement.clientWidth == 'number') { >> var getInnerDimensions = function(el) { >> return [el.clientHeight, el.clientWidth]; >> }; >> } >> > > Considering an element having scrollbars, we might use: > > return [el.scrollTop + el.clientHeight, > el.scrollLeft + el.clientWidth]; Please explain what the scroll position has to do with the element dimensions. > Note: scrollWidth/scrollHeight are buggy in IE6-8 and Opera 10 > > So, we'd need to compare (scrollTop + clientHeight) to scrollHeight too. > In IE8, scrollWidth is 5 pixels off. See > That states that *scrollHeight* is buggy in IE *5.5* to 7, and that scrollWidth is _correct_ in those versions. It also states that scrollWidth is 5 pixel off in IE 8, and that "Opera gives odd, incorrect values." Quite different from what you stated. PointedEars -- realism: HTML 4.01 Strict evangelism: XHTML 1.0 Strict madness: XHTML 1.1 as application/xhtml+xml -- Bjoern Hoehrmann