引导模式-远程url.我可以把整个模态元素放到remote.html中吗



我使用的是bootstrap 2.3.2。根据http://getbootstrap.com/2.3.2/javascript.html#modals如果提供了数据远程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>

这意味着这里的远程内容将被插入模态主体并替换

One fine body。。。

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

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

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

这加载了一个外部模式标记并启动它(在我的情况下,仅适用于InternetExplorer<9)我希望这将是一个有用的例子。

最新更新