<html>\r
<head>\r
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> \r
<title>The source code</title>\r
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
* @return {Element} this\r
*/\r
scrollTo : function(side, value, animate){\r
- var tester = /top/i,\r
- prop = "scroll" + (tester.test(side) ? "Top" : "Left"),\r
+ var top = /top/i.test(side), //check if we're scrolling top or left\r
me = this,\r
- dom = me.dom;\r
+ dom = me.dom,\r
+ prop;\r
if (!animate || !me.anim) {\r
+ prop = 'scroll' + (top ? 'Top' : 'Left'), // just setting the value, so grab the direction\r
dom[prop] = value;\r
- } else {\r
- me.anim({scroll: {to: tester.test(prop) ? [dom[prop], value] : [value, dom[prop]]}},\r
+ }else{\r
+ prop = 'scroll' + (top ? 'Left' : 'Top'), // if scrolling top, we need to grab scrollLeft, if left, scrollTop\r
+ me.anim({scroll: {to: top ? [dom[prop], value] : [value, dom[prop]]}},\r
me.preanim(arguments, 2), 'scroll');\r
}\r
return me;\r