Skip to content

Commit

Permalink
Merge pull request #238 from artem-tim/master
Browse files Browse the repository at this point in the history
Added anchor to custom event context
  • Loading branch information
kylefox committed Feb 25, 2019
2 parents a229f49 + 89528ab commit 30875a5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,13 @@ $.modal.CLOSE = 'modal:close'; // Fires when the modal begins c
$.modal.AFTER_CLOSE = 'modal:after-close'; // Fires after the modal has fully closed (including animations).
```

The first and only argument passed to these event handlers is the `modal` object, which has three properties:
The first and only argument passed to these event handlers is the `modal` object, which has four properties:

```js
modal.$elm; // Original jQuery object upon which modal() was invoked.
modal.options; // Options passed to the modal.
modal.$blocker; // The overlay element.
modal.$anchor; // Anchor element originating the event.
```

So, you could do something like this:
Expand Down
2 changes: 1 addition & 1 deletion jquery.modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@

//Return context for custom events
_ctx: function() {
return { elm: this.$elm, $elm: this.$elm, $blocker: this.$blocker, options: this.options };
return { elm: this.$elm, $elm: this.$elm, $blocker: this.$blocker, options: this.options, $anchor: this.anchor };
}
};

Expand Down
2 changes: 1 addition & 1 deletion jquery.modal.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 30875a5

Please sign in to comment.