html - Twitter bootstrap - 多个模式窗口

标签 html twitter-bootstrap modal-dialog

我在循环中使用模态窗口组件。每个循环内容都有 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/

相关文章:

javascript - 使用 JavaScript - 循环遍历每个 <li> 并添加带有链接的图片以转到每个 li 中的新页面

javascript - 在 ipad 浏览器中打开 bootstrap modal 时,是否可以将 modal-popup 窗口的位置固定在中心?我正在使用 Bootstrap v3.0.0

html - div 高度调整不包括其内容的边距

javascript - 在其他模态弹出窗口中创建模态弹出窗口

css - 如何让 'Reactjs Modal'出现在屏幕上从右到中飞

javascript - Jquery Ajax 表单需要点击 2 次才能提交

android - android fragment 是否像 HTML 中的 iframe?

css - 流体布局和位置固定

twitter-bootstrap - 单击选项时, Bootstrap 模式上的 Select2 消失?

java - Selenium - 在模式窗口中处理动态数据