2013-10-18 17 views
0

我使用twitter引導程序在我的應用程序中創建了一個模式。在onclick事件中創建模式 它在firefox和chrome中工作正常。但在ie8中運行我的應用程序時,該模式內部的NewPage.aspx頁面未正確查看。使用Modals時發出的問題

這裏是我的代碼:

<div id="MyModal" class="modal hide in"> 
     <div class="modal-dialog"> 
      <div class="modal-header"> 
       <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> 
        ×</button> 
       <h3 id="myModalLabel"> 
        Header</h3> 
      </div> 
      <div class="modal-content"> 
       <div class="modal-body"> 
        <iframe id="modal-frame" src="" style="zoom: 0.60; position: relative;" frameborder="0" 
         height="450" width="850"></iframe> 
       </div> 
      </div> 
     </div> 
    </div> 
    <button modalurl="~/NewPage.aspx" id="lnkNewModal" onclick="openMyModal(this);" 
       runat="server">Modal</Button> 

    function openMyModal(curObj) { 
      $("#MyModal").modal({ 
       "backdrop": "static", 
       "keyboard": true, 
       "show": true 
      }); 
      var url = $(curObj).data("modalurl"); 
      $('#MyModal').on('show', function() { 
       $('#modal-frame').attr("src", url); 
      }); 
      $('#MyModal').modal({ show: true }); 
     } 

謝謝大家提前對您的回覆。

+0

有問題,你的模態或頁面內的iframe ..?這段代碼如何幫助我們幫助你? – reyaner

+0

問題出在iframe中的頁面。 IE頁面在iframe中顯示不正確。 – Deepak

回答

2

您在JavaScript代碼有稍許誤差

function openMyModal(curObj) {  

var url = $(curObj).attr("modalurl"); //Note here 

      $('#MyModal').on('show', function() { 
       $('#modal-frame').attr("src", url); 
      });    
      $("#MyModal").modal({ 
       "backdrop": "static", 
       "keyboard": true, 
       "show": true 
      });    
     } 

這個完美的作品,乾杯!

+0

這完美地在Firefox和鉻.. – Deepak

+0

這完美的火狐和鉻。但在Internet Explorer中,模式大小相同,但i幀大小爲100 x 100。當我嘗試將鼠標放在它上面時,它立即消失。 – Deepak

相關問題