Skip to content

Commit 30875a5

Browse files
authored
Merge pull request kylefox#238 from artem-tim/master
Added anchor to custom event context
2 parents a229f49 + 89528ab commit 30875a5

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,13 @@ $.modal.CLOSE = 'modal:close'; // Fires when the modal begins c
210210
$.modal.AFTER_CLOSE = 'modal:after-close'; // Fires after the modal has fully closed (including animations).
211211
```
212212

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

215215
```js
216216
modal.$elm; // Original jQuery object upon which modal() was invoked.
217217
modal.options; // Options passed to the modal.
218218
modal.$blocker; // The overlay element.
219+
modal.$anchor; // Anchor element originating the event.
219220
```
220221

221222
So, you could do something like this:

jquery.modal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181

182182
//Return context for custom events
183183
_ctx: function() {
184-
return { elm: this.$elm, $elm: this.$elm, $blocker: this.$blocker, options: this.options };
184+
return { elm: this.$elm, $elm: this.$elm, $blocker: this.$blocker, options: this.options, $anchor: this.anchor };
185185
}
186186
};
187187

jquery.modal.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)