我在循环中使用模态窗口组件。每个循环内容都有 X 个具有不同 ID 的缩略图(模态也有不同的 ID),这些缩略图应通过其 data-toggle 属性触发模态,但是模态仅适用于循环的第一项,仅设置 data-toggle屏幕的背景与其余部分。 模态窗口内容和标记位于 DOM 中,只是它们不显示。
我尝试过删除淡入淡出类,重命名 ID,但到目前为止我还没有运气。 我找到了similar problem,但这对我的情况没有帮助。
可能是什么问题?
<li class="span3">
<div class="modal hide" id="modal1">
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>
<h3>Lipsum</h3>
</div>
<div class="modal-body">
<p>Lipsum</p>
<hr>
<img src="<?php the_field('srceenshot')?>">
</div>
<div class="modal-footer">
<button class="close" data-dismiss="modal">x</button>
</div>
</div>
<a class="thumbnail" data-toggle="modal" rel="popover" data-content="<?php the_field('screenshot_text')?>" data-original-title="<?php the_field('screenshot_header')?>" href="#modal1">
<img src="<?php the_field('screenshot')?>">
</a>
</li>
解决方案:
<div class="modal hide" id="modal1_<?php echo $count">
和
<a class="thumbnail" data-toggle="modal" rel="popover" data-content="<?php the_field('screenshot_text')?>" data-original-title="<?php the_field('screenshot_header')?>" href="#modal1_<?php echo $count">
最佳答案
id=modal1
需要是动态的。所以它应该类似于 id=modal_<PK of Object>
关于html - Twitter bootstrap - 多个模式窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10362778/