700d01fe37bc259ea5aafefe1e22a82f49d316c5.svn-base 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. if (!dojo._hasResource["dojo.NodeList-fx"]) { // _hasResource checks added by
  2. // build. Do not use
  3. // _hasResource directly in your
  4. // code.
  5. dojo._hasResource["dojo.NodeList-fx"] = true;
  6. dojo.provide("dojo.NodeList-fx");
  7. dojo.require("dojo.fx");
  8. dojo.extend(dojo.NodeList, {
  9. _anim : function(obj, method, args) {
  10. var anims = [];
  11. args = args || {};
  12. this.forEach(function(item) {
  13. var tmpArgs = {
  14. node : item
  15. };
  16. dojo.mixin(tmpArgs, args);
  17. anims.push(obj[method](tmpArgs));
  18. });
  19. return dojo.fx.combine(anims); // dojo._Animation
  20. },
  21. wipeIn : function(args) {
  22. // summary:
  23. // wipe in all elements of this NodeList. Returns an
  24. // instance of dojo._Animation
  25. // example:
  26. // Fade in all tables with class "blah":
  27. // | dojo.query("table.blah").wipeIn().play();
  28. return this._anim(dojo.fx, "wipeIn", args); // dojo._Animation
  29. },
  30. wipeOut : function(args) {
  31. // summary:
  32. // wipe out all elements of this NodeList. Returns an
  33. // instance of dojo._Animation
  34. // example:
  35. // Wipe out all tables with class "blah":
  36. // | dojo.query("table.blah").wipeOut().play();
  37. return this._anim(dojo.fx, "wipeOut", args); // dojo._Animation
  38. },
  39. slideTo : function(args) {
  40. // summary:
  41. // slide all elements of the node list to the specified
  42. // place.
  43. // Returns an instance of dojo._Animation
  44. // example:
  45. // | Move all tables with class "blah" to 300/300:
  46. // | dojo.query("table.blah").slideTo({
  47. // | left: 40,
  48. // | top: 50
  49. // | }).play();
  50. return this._anim(dojo.fx, "slideTo", args); // dojo._Animation
  51. },
  52. fadeIn : function(args) {
  53. // summary:
  54. // fade in all elements of this NodeList. Returns an
  55. // instance of dojo._Animation
  56. // example:
  57. // Fade in all tables with class "blah":
  58. // | dojo.query("table.blah").fadeIn().play();
  59. return this._anim(dojo, "fadeIn", args); // dojo._Animation
  60. },
  61. fadeOut : function(args) {
  62. // summary:
  63. // fade out all elements of this NodeList. Returns an
  64. // instance of dojo._Animation
  65. // example:
  66. // Fade out all elements with class "zork":
  67. // | dojo.query(".zork").fadeOut().play();
  68. // example:
  69. // Fade them on a delay and do something at the end:
  70. // | var fo = dojo.query(".zork").fadeOut();
  71. // | dojo.connect(fo, "onEnd", function(){ /*...*/ });
  72. // | fo.play();
  73. return this._anim(dojo, "fadeOut", args); // dojo._Animation
  74. },
  75. animateProperty : function(args) {
  76. // summary:
  77. // see dojo.animateProperty(). Animate all elements of this
  78. // NodeList across the properties specified.
  79. // example:
  80. // | dojo.query(".zork").animateProperty({
  81. // | duration: 500,
  82. // | properties: {
  83. // | color: { start: "black", end: "white" },
  84. // | left: { end: 300 }
  85. // | }
  86. // | }).play();
  87. return this._anim(dojo, "animateProperty", args); // dojo._Animation
  88. }
  89. });
  90. }