Created
April 7, 2016 08:13
-
-
Save ganey/88c4da82bd6b3d27313dfa5d15bce932 to your computer and use it in GitHub Desktop.
jQuery 1 active modal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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