Fade.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. Copyright (c) 2004-2012, 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. if(!dojo._hasResource["dojox.widget.rotator.Fade"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dojox.widget.rotator.Fade"] = true;
  8. dojo.provide("dojox.widget.rotator.Fade");
  9. dojo.require("dojo.fx");
  10. (function(d){
  11. function _fade(/*Object*/args, /*string*/action){
  12. // summary:
  13. // Returns an animation of a fade out and fade in of the current and next
  14. // panes. It will either chain (fade) or combine (crossFade) the fade
  15. // animations.
  16. var n = args.next.node;
  17. d.style(n, {
  18. display: "",
  19. opacity: 0
  20. });
  21. args.node = args.current.node;
  22. return d.fx[action]([ /*dojo.Animation*/
  23. d.fadeOut(args),
  24. d.fadeIn(d.mixin(args, { node: n }))
  25. ]);
  26. }
  27. d.mixin(dojox.widget.rotator, {
  28. fade: function(/*Object*/args){
  29. // summary:
  30. // Returns a dojo.Animation that fades out the current pane, then fades in
  31. // the next pane.
  32. return _fade(args, "chain"); /*dojo.Animation*/
  33. },
  34. crossFade: function(/*Object*/args){
  35. // summary:
  36. // Returns a dojo.Animation that cross fades two rotator panes.
  37. return _fade(args, "combine"); /*dojo.Animation*/
  38. }
  39. });
  40. })(dojo);
  41. }