1
我一直在尋找一個解決方案,但似乎沒有解決這個問題。Modal解僱不工作後加載函數
我在我的代碼中有一個模態加載函數腳本,它顯示的模態OK,但是當我嘗試使用代碼中的一個HTML按鈕關閉數據忽略=「模態」指令中的模態時,它doens'nt關閉模式,但如果我的「開放式模態」按鈕,然後單擊兩個關閉按鈕工作確定:
<script>
setTimeout(function(){
$(window).load(function(){
$('#myModal').modal('show');
},3000);
</script>
<div class="container"><!-- Trigger the modal with a button --> <button class="btn btn-info btn-lg" type="button" data-toggle="modal" data-target="#myModal">Open Modal</button> <!-- Modal -->
<div id="myModal" class="modal fade" tabindex="-1">
<div class="modal-dialog"><!-- Modal content-->
<div class="modal-content">
<div class="modal-header"><button class="close" type="button" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer"><button class="btn btn-default" type="button" data-dismiss="modal">Close</button></div>
</div>
</div>
</div>
</div>
所以數據駁回=「莫代爾」只能當我從「打開模式」按鈕手動加載模式,但當我使用加載功能在頁面上顯示它時不起作用廣告。
我會感謝任何幫助和任何建議將受到歡迎,
謝謝。
你的JavaScript會導致錯誤。 – SaJed
您好SaJed,感謝您的幫助,我測試了您發給我的腳本,但仍然無法工作,您認爲我應該在腳本中以某種方式實例化關閉按鈕嗎?因爲它在載入加載函數時似乎沒有與模態鏈接,但在使用觸發器按鈕進行加載時工作完美無缺。 –
順便說一句,在snipcode運行表明,其工作 – SaJed