root / trunk / web / dojo / dojox / fx / scroll.js @ 9
History | View | Annotate | Download (1.01 KB)
1 |
/*
|
---|---|
2 |
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
3 |
Available via Academic Free License >= 2.1 OR the modified BSD license.
|
4 |
see: http://dojotoolkit.org/license for details
|
5 |
*/
|
6 |
|
7 |
|
8 |
if(!dojo._hasResource["dojox.fx.scroll"]){ |
9 |
dojo._hasResource["dojox.fx.scroll"]=true; |
10 |
dojo.provide("dojox.fx.scroll");
|
11 |
dojo.experimental("dojox.fx.scroll");
|
12 |
dojo.require("dojox.fx._core");
|
13 |
dojox.fx.smoothScroll=function(_1){ |
14 |
if(!_1.target){
|
15 |
_1.target=dojo.position(_1.node,true);
|
16 |
} |
17 |
var _2=dojo[(dojo.isIE?"isObject":"isFunction")](_1["win"].scrollTo),_3={x:_1.target.x,y:_1.target.y}; |
18 |
if(!_2){
|
19 |
var _4=dojo.position(_1.win);
|
20 |
_3.x-=_4.x; |
21 |
_3.y-=_4.y; |
22 |
} |
23 |
var _5=(_2)?(function(_6){ |
24 |
_1.win.scrollTo(_6[0],_6[1]); |
25 |
}):(function(_7){
|
26 |
_1.win.scrollLeft=_7[0];
|
27 |
_1.win.scrollTop=_7[1];
|
28 |
}); |
29 |
var _8=new dojo.Animation(dojo.mixin({beforeBegin:function(){ |
30 |
if(this.curve){ |
31 |
delete this.curve; |
32 |
} |
33 |
var _9=_2?dojo._docScroll():{x:_1.win.scrollLeft,y:_1.win.scrollTop}; |
34 |
_8.curve=new dojox.fx._Line([_9.x,_9.y],[_3.x,_3.y]);
|
35 |
},onAnimate:_5},_1));
|
36 |
return _8;
|
37 |
}; |
38 |
} |