X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775:/src/core/Element.scroll-more.js diff --git a/src/core/Element.scroll-more.js b/src/core/Element.scroll-more.js index e02c3c08..ef5fd72b 100644 --- a/src/core/Element.scroll-more.js +++ b/src/core/Element.scroll-more.js @@ -1,5 +1,5 @@ /*! - * Ext JS Library 3.0.0 + * Ext JS Library 3.0.3 * Copyright(c) 2006-2009 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license @@ -16,15 +16,15 @@ Ext.Element.addMethods({ * @return {Element} this */ scrollTo : function(side, value, animate){ - var tester = /top/i, - prop = "scroll" + (tester.test(side) ? "Top" : "Left"), - me = this, - dom = me.dom; + var top = /top/i.test(side), //check if we're scrolling top or left + prop = 'scroll' + (top ? 'Left' : 'Top'), // if scrolling top, we need to grab scrollLeft, if left, scrollTop + me = this, + dom = me.dom; if (!animate || !me.anim) { dom[prop] = value; } else { - me.anim({scroll: {to: tester.test(prop) ? [dom[prop], value] : [value, dom[prop]]}}, - me.preanim(arguments, 2), 'scroll'); + me.anim({scroll: {to: top ? [dom[prop], value] : [value, dom[prop]]}}, + me.preanim(arguments, 2), 'scroll'); } return me; },