-
-
Save mxub/3236116 to your computer and use it in GitHub Desktop.
Dynamic (AJAX) loaded Bootstrap Modal (Bootstrap 2.0)
This file contains hidden or 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
$(document).ready(function() { | |
// Support for AJAX loaded modal window | |
$('.to_modal').click(function(e) { | |
e.preventDefault(); | |
var href = $(e.target).attr('href'); | |
if (href.indexOf('#') == 0) { | |
$(href).modal('open'); | |
} else { | |
$.get(href, function(data) { | |
$('<div class="modal fade" >' + data + '</div>').modal(); | |
}); | |
} | |
}); | |
}); |
This file contains hidden or 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
<a herf="/url/to/load/modal_window.htm" class="to_modal">link</a> |
This file contains hidden or 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
<div class="modal-header"> | |
<a href="#" class="close js-dismiss">×</a> | |
<h3>Modal header 2</h3> | |
</div> | |
<div class="modal-body"> | |
<p>One body...</p> | |
</div> | |
<div class="modal-footer"> | |
<input class="btn primary" type="submit" value="Save Changes" /> | |
<a href="#" class="btn js-dismiss">Close</a> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment