I'm facing the problem of displaying image within bootstrap modal.
I use this plugin: Magnific-Popup
Follow the code:
HTML:
<!-- Button trigger modal -->
<button type="button" id="mymodal" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
<a class="test-popup-link" href="http://i.imgur.com/YZ7AGyF.jpg">Open popup</a>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
JS:
$(document).ready(function() {
$('.test-popup-link').magnificPopup({
type: 'image'
});
});
Final result:
Here'sjsfiddle: link
NOTE: The image should not be behind the modal, always the front of the modal.
Any bright solution?