diff options
| author | Tristan Zur <tzur@web.web.ccwn.org> | 2014-03-27 22:27:47 +0100 |
|---|---|---|
| committer | Tristan Zur <tzur@web.web.ccwn.org> | 2014-03-27 22:27:47 +0100 |
| commit | b62676ca5d3d6f6ba3f019ea3f99722e165a98d8 (patch) | |
| tree | 86722cb80f07d4569f90088eeaea2fc2f6e2ef94 /js/dojo-1.6/dojox/fx/scroll.js | |
Diffstat (limited to 'js/dojo-1.6/dojox/fx/scroll.js')
| -rw-r--r-- | js/dojo-1.6/dojox/fx/scroll.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/js/dojo-1.6/dojox/fx/scroll.js b/js/dojo-1.6/dojox/fx/scroll.js new file mode 100644 index 0000000..e985ebf --- /dev/null +++ b/js/dojo-1.6/dojox/fx/scroll.js @@ -0,0 +1,52 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+if(!dojo._hasResource["dojox.fx.scroll"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.fx.scroll"] = true;
+dojo.provide("dojox.fx.scroll");
+dojo.experimental("dojox.fx.scroll");
+
+dojo.require("dojox.fx._core");
+
+dojox.fx.smoothScroll = function(/* Object */args){
+ // summary: Returns an animation that will smooth-scroll to a node
+ // description: This implementation support either horizontal or vertical scroll, as well as
+ // both. In addition, element in iframe can be scrolled to correctly.
+ // offset: {x: int, y: int} this will be added to the target position
+ // duration: Duration of the animation in milliseconds.
+ // win: a node or window object to scroll
+
+ if(!args.target){ args.target = dojo.position(args.node); }
+
+ var isWindow = dojo[(dojo.isIE ? "isObject" : "isFunction")](args["win"].scrollTo),
+ delta = { x: args.target.x, y: args.target.y }
+ ;
+ if(!isWindow){
+ var winPos = dojo.position(args.win);
+ delta.x -= winPos.x;
+ delta.y -= winPos.y;
+ }
+ var _anim = (isWindow) ?
+ (function(val){
+ args.win.scrollTo(val[0],val[1]);
+ }) :
+ (function(val){
+ args.win.scrollLeft = val[0];
+ args.win.scrollTop = val[1];
+ });
+ var anim = new dojo.Animation(dojo.mixin({
+ beforeBegin: function(){
+ if(this.curve){ delete this.curve; }
+ var current = isWindow ? dojo._docScroll() : {x: args.win.scrollLeft, y: args.win.scrollTop};
+ anim.curve = new dojox.fx._Line([current.x,current.y],[current.x + delta.x, current.y + delta.y]);
+ },
+ onAnimate: _anim
+ },args));
+ return anim; // dojo.Animation
+};
+
+}
|
