NodeList-style.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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.fx.ext-dojo.NodeList-style"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
  7. dojo._hasResource["dojox.fx.ext-dojo.NodeList-style"] = true;
  8. dojo.provide("dojox.fx.ext-dojo.NodeList-style");
  9. dojo.experimental("dojox.fx.ext-dojo.NodeList-style");
  10. // summary:
  11. // Core extensions to `dojo.NodeList` providing addtional fx to `dojo.NodeList-fx`
  12. // from `dojox.fx.style`
  13. //
  14. // description:
  15. // A Package to extend dojo base NodeList with fx provided by the `dojox.fx` project.
  16. // These are experimental animations, in an experimental
  17. dojo.require("dojo.NodeList-fx");
  18. dojo.require("dojox.fx.style");
  19. dojo.extend(dojo.NodeList, {
  20. addClassFx: function(cssClass, args){
  21. // summary:
  22. // Animate the effects of adding a class to all nodes in this list.
  23. // see `dojox.fx.addClass`
  24. //
  25. // tags: FX, NodeList
  26. //
  27. // example:
  28. // | // fade all elements with class "bar" to to 50% opacity
  29. // | dojo.query(".bar").addClassFx("bar").play();
  30. return dojo.fx.combine(this.map(function(n){ // dojo.Animation
  31. return dojox.fx.addClass(n, cssClass, args);
  32. }));
  33. },
  34. removeClassFx: function(cssClass, args){
  35. // summary:
  36. // Animate the effect of removing a class to all nodes in this list.
  37. // see `dojox.fx.removeClass`
  38. //
  39. // tags: FX, NodeList
  40. //
  41. // example:
  42. // | dojo.query(".box").removeClassFx("bar").play();
  43. return dojo.fx.combine(this.map(function(n){ // dojo.Animation
  44. return dojox.fx.removeClass(n, cssClass, args);
  45. }));
  46. },
  47. toggleClassFx: function(cssClass, force, args){
  48. // summary:
  49. // Animate the effect of adding or removing a class to all nodes in this list.
  50. // see `dojox.fx.toggleClass`
  51. //
  52. // tags: FX, NodeList
  53. //
  54. // example:
  55. // | dojo.query(".box").toggleClass("bar").play();
  56. return dojo.fx.combine(this.map(function(n){ // dojo.Animation
  57. return dojox.fx.toggleClass(n, cssClass, force, args);
  58. }));
  59. }
  60. });
  61. }