2014-09-01 69 views
1

我有負載和消失幾乎立即模式窗口,模態窗口顯示很簡單

<ul> 
    <li><a href="#" class="btn btn-lg btn-success" data-toggle="modal" data-target="#basicModal">School Management Portal</a></li> 
</ul> 

<div class="modal fade in modal-dialog modal-content" id="basicModal" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true"> 
    <div class="modal-header"> 
     <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&amp;times;</button> 

     <h4 class="modal-title" id="myModalLabel">Modal title</h4> 
    </div> 

    <div class="modal-body"> 
     <h3>Modal Body</h3> 
    </div> 

    <div class="modal-footer"> 
     <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> 
    </div> 
</div> 
<script type="text/javascript"> 
    $('#myModal').modal('show') 
</script> 

爲什麼它關閉modal('show')後如此迅速?

回答

1

我相信這

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

應該

$('#basicModal').modal('show'); 

因爲那是你的模式divid

或者(但出於同樣的原因),這

<div class="modal fade in modal-dialog modal-content" id="basicModal" 

可能是

<div class="modal fade in modal-dialog modal-content" id="myModal" 

我相信你只能看到它的負荷,以及消失,因爲它不是」不可見。基本上,您的show()目前不起作用。