Create bootstrap image modal popup

Create bootstrap image modal popup

Here is simple code to make image or gallery modal popup using bootstrap. You only need copy and paste to your source.


<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">
<img src=""/></button>

<div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<img src="//placehold.it/1000x600" class="img-responsive">
</div>
</div>
</div>
</div>

You can change button with anything you want, such as: Text, image …etc.

Important to know: the button have the attribute data-target=”#MyModal“, it will the id of <Div> popup below

Just relax now.

 

Share this post

Post Comment