我正在尝试在我的网站上的投资组合部分显示一些图片。在投资组合的背景下,您可以看到不同的图片,但是当我点击“显示详细信息”时,它会在同一页面上打开新窗口,但图片是相同的,而不是不同的...它在两者中显示pic1.png,而不是pic1.png和pic2.png。
请帮帮我,这让我发疯了。
这是我的HTML代码
<!-- PORTFOLIO IMAGE 1 -->
<div class="col-md-4 ">
<div class="grid mask">
<figure> <img class="img-responsive" src="assets/img/portfolio/slika1.png" alt="">
<figcaption>
<h5>UX / UI</h5>
<a data-toggle="modal" href="#myModal" class="btn btn-default">More Details</a> </figcaption>
<!-- /figcaption -->
</figure>
<!-- /figure -->
</div>
<!-- /grid-mask -->
</div>
<!-- MODAL SHOW THE PORTFOLIO IMAGE. In this demo, all links point to this modal. You should create
a modal for each of your projects. -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Project Title</h4>
</div>
<div class="modal-body">
<p><img class="img-responsive" src="assets/img/portfolio/slika1.png" alt=""></p>
<p>Content1</p>
<p><b><a href="#">Visit Site</a></b></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
<!-- PORTFOLIO IMAGE 1 -->
<div class="col-md-4 ">
<div class="grid mask">
<figure> <img class="img-responsive" src="assets/img/portfolio/slika2.png" alt="">
<figcaption>
<h5>UX / UI</h5>
<a data-toggle="modal" href="#myModal" class="btn btn-default">More Details</a> </figcaption>
<!-- /figcaption -->
</figure>
<!-- /figure -->
</div>
<!-- /grid-mask -->
</div>
<!-- MODAL SHOW THE PORTFOLIO IMAGE. In this demo, all links point to this modal. You should create
a modal for each of your projects. -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Project Title</h4>
</div>
<div class="modal-body">
<p><img class="img-responsive" src="assets/img/portfolio/slika2.png" alt=""></p>
<p>Content2</p>
<p><b><a href="#">Visit Site</a></b></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
</div>
谢谢你们
答案 0 :(得分:1)
您需要为不同的模态使用不同的ID:
变化:
<div class="modal fade" id="myModal"
到
<div class="modal fade" id="myModal2"
关于第二个模态
还更新链接参考:
<a data-toggle="modal" href="#myModal2"