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