【问题标题】:bootstrap modal - remote url. Can I put the whole modal element into remote.html?引导模式 - 远程 URL。我可以将整个模态元素放入remote.html吗?
【发布时间】:2023-03-20 17:22:01
【问题描述】:

我正在使用引导程序 2.3.2。根据http://getbootstrap.com/2.3.2/javascript.html#modals 如果提供了 data-remote url,那么 url 的内容将被注入到 .modal-body 中。

我的 index.html:

<a data-remote="remote.php" data-target="#myModal" data-toggle="modal">Launch demo modal</a>

<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Modal Test Header</h3>
  </div>
  <div class="modal-body">
    <p>One fine body…</p>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
    <button class="btn btn-primary">Save changes</button>
  </div>
</div>​

remote.php

<div>remote content goes here</div>

这意味着这里的远程内容将被插入到modal-body中并被替换

好身材……

但是,我想知道是否可以将整个#myModel 保存到 remote.html 中,即。从 index.html 中取出 #myModal 并将其放入 remote.php。我已经尝试过了,但它不起作用。

【问题讨论】:

    标签: jquery twitter-bootstrap modal-dialog


    【解决方案1】:

    我有一个这样的模态......

    <!--[if lt IE 9]>
         <script type="text/javascript">
            $( "#placeholder" ).load( "/html/myExternalModalDiv.html", function() {
                $('#myExternalModalDiv').modal('toggle');
            });
         </script>
    <![endif]-->
    

    这会加载一个外部模态标记并触发它(仅适用于 Internet Explorer

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-21
      • 2022-08-15
      • 2011-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多