2017-08-01 51 views
1

image herebootstrap:主要显示模态,同时点击iframe

我对这种模式使用Bootstrap。请查看我的插图,知道我想说什么。我尝试了这一点,但结果并不像图中所示。我无法显示模式。

main.html中

<!-- Modal content--> 
<div class="modal-content"> 
    <div class="modal-header"> 
    <button type="button" class="close" data-dismiss="modal">&times;</button> 
    <h4 class="modal-title">Modal Header</h4> 
    </div> 
    <div class="modal-body"> 
    <iframe src='b.html' frameborder=0></iframe> 
    </div> 
    <div class="modal-footer"> 
    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> 
    </div> 
</div> 

b.html

<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myshow">Open Modal</button> 
+1

我不认为你可以做到这一点,因为该模式中不存在b.html。 – Aslam

+0

我做到了,但是...模态只会出现在b上。我想出现在主 – dpesquera

+0

我认为它不会直接出现。除非别人有其他解决方案。 – Aslam

回答

1

好吧,我设法打开我的模态到父(main.html中),但每当我加载b.html模态时会出现。

b.html

只是增加了一个脚本上b.html

window.parent.parent.$('#myModal').modal('show'); 

我现在的问题是如何显示模式,只有当点击来自b.html


的解决方法我OWN问题:

在b.html中添加脚本

$(document).ready(function() { 

    // Attach Button click event listener 
    $("#btnPopModal").click(function(){ 

     // show Modal 
      window.parent.parent.$('#mypob').modal('show'); 
    }); 
}); 

,就是这样...感谢