1 if(!dojo._hasResource["dojox.fx.scroll"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["dojox.fx.scroll"] = true;
3 dojo.provide("dojox.fx.scroll");
4 dojo.experimental("dojox.fx.scroll");
6 dojo.require("dojox.fx._core");
8 dojox.fx.smoothScroll = function(/* Object */args){
9 // summary: Returns an animation that will smooth-scroll to a node (specified in etup())
10 // description: This implementation support either horizental or vertical scroll, as well as
11 // both. In addition, element in iframe can be scrolled to correctly.
12 // offset: {x: int, y: int} this will be added to the target position
13 // duration: Duration of the animation in milliseconds.
14 // win: a node or window object to scroll
16 if(!args.target){ args.target = dojo.coords(args.node,true); }
18 var isWindow = dojo[(dojo.isIE ? "isObject" : "isFunction")](args["win"].scrollTo);
20 var _anim = (isWindow) ?
22 args.win.scrollTo(val[0],val[1]);
25 args.win.scrollLeft = val[0];
26 args.win.scrollTop = val[1];
29 var anim = new dojo._Animation(dojo.mixin({
30 beforeBegin: function(){
31 if(this.curve){ delete this.curve; }
32 var current = isWindow ? dojo._docScroll() : {x: args.win.scrollLeft, y: args.win.scrollTop};
33 anim.curve = new dojox.fx._Line([current.x,current.y],[args.target.x,args.target.y]);
37 return anim; // dojo._Animation