View Full Version : Element.scrollIntoView
6 Apr 2007, 5:57 AM
public function scrollIntoView([String/HTMLElement/Element container])
* container : String/HTMLElement/Element
(optional) The container element to scroll (defaults to document.body)
but doesn't. Btw. second argument is missing in doumentation
9 Aug 2007, 4:05 AM
this doest work for me too
9 Aug 2007, 4:43 AM
The way round you must use it is
15 Aug 2007, 12:38 PM
This work-around is very implementation specific. The id-of-container-element must be configured to scroll. In my example below, without adding the height and overflow attributes the scroll into view did not work:
<div id="id-of-container-element" style="width:600px; height:400px; overflow:auto;">
... lots of content here that is pushing my element out of view ...
<div id="id-of-element-to-be-visible"> ... </div>
How do I use Element.scrollIntoView() to scroll the document body so that the element is in view?
I should note that I am using ext2.0.
15 Aug 2007, 11:56 PM
Obviously only works if the body is the element that must be scrolled to get the element into view.
If you are using a Layout, then it's the Element of the Layout's containing the element you want in view that must be scrolled.
16 Aug 2007, 11:19 AM
I wish it were always as simple as document.body. Setting the document.body.scrollTop has no effect unless operating in quirks mode.
My testbed used an HTML 4.01 transitional doctype and I was only ever able to scrollIntoView a scrollable div, but never the body; however using document.documentElement works (tested in FF, IE6, IE7).
Specifically, I am now able to do this (when not in quirks mode):
I was completely wrong when I said I was implementing this with ext2.0; I was actually doing all these tests against ext1.1. Unfortunately the discovery above does not work with ext2.0. It seems ext2.0 is only able to scrollIntoView a scrollable div (even in quirks mode).
Whereas ext1.1::Element.scrollIntoView() could be patched with a ternary Ext.isStrict test, ext2.0::Element.scrollIntoView() needs some additional love.
17 Aug 2007, 2:19 AM
Thanks for digging into this Rex. I will do some testing in Strict mode.
30 Sep 2008, 8:19 PM
Did anyone ever come up with a fix/workaround for this? I'm in strict mode and scrollIntoView() isn't working. No error, but no scroll either in FF3.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.