Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose current modal #178

Closed
ShaneTWright opened this issue Sep 9, 2016 · 1 comment
Closed

Expose current modal #178

ShaneTWright opened this issue Sep 9, 2016 · 1 comment

Comments

@ShaneTWright
Copy link

ShaneTWright commented Sep 9, 2016

I would like to be able to access the current modal without having to track the modal states independently of the state tracking within the plugin.

This should be fairly easy to expose by adding a "getCurrent" method to $.modal which is a direct reference to the current "getCurrent" function.

$.modal.getCurrent = getCurrent;

Or, if you would rather not expose the modal instance itself you could add a "getCurrent" method to $.modal which wraps the current "getCurrent" function and return the modal instance's $elem only.

$.modal.getCurrent = function () {
  var current = getCurrent();

  return current !== null ? current.$elem : current;
};

However this seems awkward as access to the $blocker and options would probably be useful as well. Also, this same result could currently be achieved with:

function  myGetCurrent () {
  return $('.jquery-modal.blocker.current').children('.modal');
}

But that would get inefficient (relatively) if I needed to work through multiple, stacked modals.

@kylefox
Copy link
Owner

kylefox commented Sep 11, 2016

Thanks for the suggestion @ShaneTWright — this is now available in the 0.7.3 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants