NodeList-style.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. define("dojox/fx/ext-dojo/NodeList-style", ["dojo/_base/lang", "dojo/_base/NodeList","dojo/NodeList-fx", "dojo/fx", "../style"],
  2. function(lang, NodeList, NodeListFx, coreFx, styleX){
  3. // summary:
  4. // Core extensions to `dojo.NodeList` providing additional fx to `dojo.NodeList-fx`
  5. // from `dojox.fx.style`
  6. //
  7. // description:
  8. // A Package to extend dojo base NodeList with fx provided by the `dojox.fx` project.
  9. // These are experimental animations, in an experimental
  10. lang.extend( NodeList, {
  11. addClassFx: function(cssClass, args){
  12. // summary:
  13. // Animate the effects of adding a class to all nodes in this list.
  14. // see `dojox.fx.addClass`
  15. //
  16. // tags: FX, NodeList
  17. //
  18. // example:
  19. // | // fade all elements with class "bar" to to 50% opacity
  20. // | dojo.query(".bar").addClassFx("bar").play();
  21. return coreFx.combine(this.map(function(n){ // dojo.Animation
  22. return styleX.addClass(n, cssClass, args);
  23. }));
  24. },
  25. removeClassFx: function(cssClass, args){
  26. // summary:
  27. // Animate the effect of removing a class to all nodes in this list.
  28. // see `dojox.fx.removeClass`
  29. //
  30. // tags: FX, NodeList
  31. //
  32. // example:
  33. // | dojo.query(".box").removeClassFx("bar").play();
  34. return coreFx.combine(this.map(function(n){ // dojo.Animation
  35. return styleX.removeClass(n, cssClass, args);
  36. }));
  37. },
  38. toggleClassFx: function(cssClass, force, args){
  39. // summary:
  40. // Animate the effect of adding or removing a class to all nodes in this list.
  41. // see `dojox.fx.toggleClass`
  42. //
  43. // tags: FX, NodeList
  44. //
  45. // example:
  46. // | dojo.query(".box").toggleClass("bar").play();
  47. return coreFx.combine(this.map(function(n){ // dojo.Animation
  48. return styleX.toggleClass(n, cssClass, force, args);
  49. }));
  50. }
  51. });
  52. return NodeList;
  53. });