2013-10-26 50 views
2

截圖黑色區域 - http://screencast.com/t/DxdVjiC7idUl引導模式錯誤 - 只無窗

<div id="edit_form" class="modal 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">Редактирование объекта</h3> 
    </div> 
    <div class="modal-body" id="fm_edit_obj"> 
    </div> 
    <div class="modal-footer"> 
     <button class="btn" data-dismiss="modal" aria-hidden="true">Отменить</button> 
     <button class="btn btn-primary">Сохранить изменения</button> 
    </div> 
    </div> 

在點擊圖像 -

$('#edit_form').modal({'show' : true}); 

爲什麼我不能看到窗戶,只有背景是什麼?

回答

2

使用bootstrap文檔作爲指導,假設您使用bootstrap v3,則缺少「模態對話框」和「模態內容」div。在這裏,我改變並測試你的代碼:

<div id="edit_form" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> 
    <div class="modal-dialog"> 
     <div class="modal-content"> 
      <div class="modal-header"> 
       <button type="button" class="close" data-dismiss="modal" aria-hidden="true">?</button> 
       <h3 id="myModalLabel">Редактирование объекта</h3> 
      </div> 
      <div class="modal-body" id="fm_edit_obj"> 
      BODY 
      </div> 
      <div class="modal-footer"> 
       <button class="btn" data-dismiss="modal" aria-hidden="true">Отменить</button> 
       <button class="btn btn-primary">Сохранить изменения</button> 
      </div> 
     </div> 
    </div> 
    </div> 
    <img src="/img/knot.jpg" alt="" id="myimg"> 

<script> 
$('#myimg').click(function(){ 
    $('#edit_form').modal('show'); 
}); 
</script> 
+0

謝謝!我閱讀了舊版本的文檔 – MaxNikitin