簡單方法解決bootstrap3 modal異步加載只一次的問題
用過bootstrap3自身的modal的remote屬性的人可能都有相同的疑惑:就是點擊彈出modal后再次點擊會從緩存中加載內容,而不會再次走后臺,解決辦法就是只要讓modal本身的屬性發生變化,它便會不會加載緩存。現在可以用一個簡單的方法解決此問題:
$('body').on('hidden.bs.modal', '.modal', function () { $(this).removeData('bs.modal'); });
?
1 $('body').on('hidden.bs.modal', '.modal', function () { 2 $(this).removeData('bs.modal'); 3 });
?
在公共的js頁面中加入此段代碼,即可禁止所有modal加載緩存的內容!
bootstrap 5。?
posted on 2015-12-12 14:42 明凈 閱讀(...) 評論(...) 編輯 收藏