3 * Copyright(c) 2006-2010 Sencha Inc.
5 * http://www.sencha.com/license
10 Ext.Element.addMethods({
12 * Returns true if this element is scrollable.
15 isScrollable : function(){
17 return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;
21 * Scrolls this element the specified scroll point. It does NOT do bounds checking so if you scroll to a weird value it will try to do it. For auto bounds checking, use scroll().
22 * @param {String} side Either "left" for scrollLeft values or "top" for scrollTop values.
23 * @param {Number} value The new scroll value.
24 * @return {Element} this
26 scrollTo : function(side, value){
27 this.dom["scroll" + (/top/i.test(side) ? "Top" : "Left")] = value;
32 * Returns the current scroll position of the element.
33 * @return {Object} An object containing the scroll position in the format {left: (scrollLeft), top: (scrollTop)}
35 getScroll : function(){
39 docElement = doc.documentElement,
44 if(d == doc || d == body){
45 if(Ext.isIE && Ext.isStrict){
46 l = docElement.scrollLeft;
47 t = docElement.scrollTop;
49 l = window.pageXOffset;
50 t = window.pageYOffset;
52 ret = {left: l || (body ? body.scrollLeft : 0), top: t || (body ? body.scrollTop : 0)};
54 ret = {left: d.scrollLeft, top: d.scrollTop};