Created
February 7, 2014 00:50
-
-
Save NathanQ/8855529 to your computer and use it in GitHub Desktop.
Bootstrap 3 will put a page into it's modal. Here is a way to add a section of the page to the modal using jQuery's .load().
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
<!-- link --> | |
<a href="/article.html" class="triggerModal" > | |
<!-- modal --> | |
<div id="modal" class="modal fade modal-dialog" tabindex="-1" role="dialog" aria-labelledby="yourMom" aria-hidden="true"> | |
<div class="container"> | |
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button> | |
<div class="row"> | |
<div id="response_modal"></div> | |
</div> | |
</div> | |
</div> | |
<!-- script --> | |
<script> | |
$('.triggerModal').click(function(e) { | |
var responseUrl = $(this).attr('href'); // make the variable the url of the a tag | |
$('#response_modal').load(responseUrl + ' #idOfTheDivYouWantToLoad'); // dump the target page's id contents into the modal | |
$('#modal').modal(); // open the bootstrap modal | |
return false; // don't go to the url of the a tag | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment