I am using bootstrap and have a button:
<button type="button" class="btn btn-primary">Popup image</button>
I have an image on the same directory and would like to have it popup in some kind of overlay where the background is grey if that is possible. I am used to javascript, so normally would do something like onclick and call a function that would do it. But in bootstrap I am unsure of how to do this. Thank you
Images can be fitted in modal popup using Bootstrap by including <img> tag in the “modal-body” div. The “modal-body” div determines the main content of modal popup. By using the <img> tag, an image can be inserted into it.
This will show up a piece of code, if you want to simply show an image, put the id="popup" directly on your <img> tag.
Modal Image A modal is a dialog box/popup window that is displayed on top of the current page.
You can do something like this..
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">Popup image</button>
<div id="myModal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<img src="//placehold.it/1000x600" class="img-responsive">
</div>
</div>
</div>
</div>
Demo: http://www.bootply.com/123443
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With