Skip to content

Instantly share code, notes, and snippets.

@ganey
Created April 7, 2016 08:13
Show Gist options
  • Save ganey/88c4da82bd6b3d27313dfa5d15bce932 to your computer and use it in GitHub Desktop.
Save ganey/88c4da82bd6b3d27313dfa5d15bce932 to your computer and use it in GitHub Desktop.
jQuery 1 active modal
// Not my code
// Code from here: http://www.minimit.com/articles/solutions-tutorials/bootstrap-3-open-only-one-modal-at-time
// Storing here for reference
var modalUniqueClass = ".modal";
$('.modal').on('show.bs.modal', function(e) {
var $element = $(this);
var $uniques = $(modalUniqueClass + ':visible').not($(this));
if ($uniques.length) {
$uniques.modal('hide');
$uniques.one('hidden.bs.modal', function(e) {
$element.modal('show');
});
return false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment