我在1个帖子中有2-5张图片,当我点击Bootstrap模态时,我想显示所有帖子的所有图像。
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
ALL IMAGES WILL SHOW HERE
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
答案 0 :(得分:0)
Using jquery
=============
添加以下jquery代码以将图像添加到模态
$("#show").on("click", function() {$(".modal-body").html("<img src='https://static.pexels.com/photos/54278/pexels-photo-54278.jpeg' width='80px'><img src='https://static.pexels.com/photos/51397/legs-window-car-dirt-road-51397.jpeg' width='80px'><img src='https://static.pexels.com/photos/21014/pexels-photo.jpg' width='80px'>" ); })