I#39;ve two modals on a page, (i#39;m using bootstrap); clicking on any modal opens only the first. I don#39;t understand js; is there an html fix?(我在一个页面上有两个模式,(我正在使用引导程序);单击任何模式只会打开第一个.我不懂js;有html修复吗?) - IT屋-程序员软件开发技
问题描述
这是第一个模态的代码;在接下来的两个模态中,所有变化都是内部的图像链接,但只有这些显示出来.
This is the code for the first modal; all that changes in the next two modals is the image links inside, but only these show up.
<div id="modallinkleft">
<a href="#myModal" data-toggle="modal">
<img src="bXlsaW5rcy9jcC8xMTdzLmpwZw==">
<img src="bXlsaW5rcy9jcC8yM3MuanBn">
<img src="bXlsaW5rcy9jcC8wOHMuanBn">
</a>
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-body">
<img src="bXlsaW5rcy9jcC8xMTcuanBn">
<img src="bXlsaW5rcy9jcC8yMy5qcGc=">
<img src="bXlsaW5rcy9jcC8wOC5qcGc=">
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">x</button>
</div>
</div>
</div>
推荐答案
每个modal应该被赋予一个不同的id并且每个链接应该定位到不同的模态 ID.所以应该是这样的:
Each modal should be given a different id and each link should be targeted to a different modal id. So it should be something like that:
<a href="#myModal" data-toggle="modal">
...
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
...
<a href="#myModal2" data-toggle="modal">
...
<div id="myModal2" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"></div>
...
这样,如果你点击第一个链接,它应该会弹出第一个模态,如果你点击第二个 - 会弹出第二个模态.
In this way, if you click the first link, it should pop-up the first modal and if you click the second - the second modal is popped up.
这篇关于我在一个页面上有两个模式,(我正在使用引导程序);单击任何模式只会打开第一个.我不懂js;有html修复吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:我在一个页面上有两个模式,(我正在使用引导程序);单击任何模式只会打开第一个.我不懂js;有html修复吗?


- 400或500级别的HTTP响应 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Flexslider 箭头未正确显示 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01