Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2150 mathias 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");
5
 
6
dojo.require("dojox.fx._core");
7
 
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
15
 
16
	if(!args.target){ args.target = dojo.coords(args.node,true); }
17
 
18
	var isWindow = dojo[(dojo.isIE ? "isObject" : "isFunction")](args["win"].scrollTo);
19
 
20
	var _anim = (isWindow) ?
21
		(function(val){
22
			args.win.scrollTo(val[0],val[1]);
23
		}) :
24
		(function(val){
25
			args.win.scrollLeft = val[0];
26
			args.win.scrollTop = val[1];
27
		});
28
 
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]);
34
		},
35
		onAnimate: _anim
36
	},args));
37
	return anim; // dojo._Animation
38
};
39
 
40
}