Skip to content

Commit

Permalink
Adding support for multiple targets for FxReveal behaviors.
Browse files Browse the repository at this point in the history
  • Loading branch information
anutron committed Oct 27, 2011
1 parent ee3a816 commit 9dc158f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Docs/Delegators/Delegator.Fx.Reveal.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ Provides delegated links to use [Fx.Reveal](http://mootools.net/docs/more/Fx/Fx.
<a style="display: block" id="dissolveSelf" data-trigger="dissolve" data-dissolve-options="'fxOptions':{'duration': 0}">Dissolve self</a>
<a style="display: block" id="nixParent" data-trigger="nix" data-nix-options="'target':'!div', 'fxOptions':{'duration': 0}">nix parent</a>
<a style="display: block" id="nixSelf" data-trigger="nix" data-nix-options="'fxOptions':{'duration': 0}">Nix self</a>
<a style="display: block" id="nixAll" data-trigger="nix" data-nix-options="'targets':'!div a">Nix all the links</a>
</p>
</div>

The above examples use `Fx.Reveal` to show, hide, and destroy their respective targets.

### Options

* target - (*string*; required) - a selector which will return the DOM element to show/hide. Use selectors provided by [Slick](https://github.com/mootools/slick) to select parents and sibling trees.
* target - (*string*) - a selector which will return the DOM element to show/hide. Use selectors provided by [Slick](https://github.com/mootools/slick) to select parents and sibling trees.
* targets - (*string*) - same as `target` except this will apply the effect to multiple targets (all the ones that match the selector).
* fxOptions - (*object*; optional) - a set of options to be passed to `Fx.Reveal`.
6 changes: 5 additions & 1 deletion Source/Delegators/Delegator.FxReveal.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ name: Delegator.FxReveal
triggers[action] = {
handler: function(event, link, api){
var target = link;
if (api.get('target')) {
if (api.get('target')){
target = link.getElement(api.get('target'));
if (!target) api.fail('could not locate target element to ' + action, link);
}
if (api.get('targets')){
target = link.getElements(api.get('targets'));
if (!target.length) api.fail('could not locate target elements to ' + action, link);
}

var fxOptions = api.get('fxOptions');
if (fxOptions) target.set('reveal', fxOptions);
Expand Down

0 comments on commit 9dc158f

Please sign in to comment.