0
我正在使用jQuery插件Remodal爲我的網站創建一個模式。我在他們的網站上查看文檔,但是我遇到了打開和關閉模式的問題。如果我打開模式,然後在下次頁面加載模式時刷新我的瀏覽器仍將打開。我使用var inst = $('[data-remodal-id=modal]').remodal();
創建了一個模態的實例,並做了一個console.log(inst.getState());
,模態被卡在「開放」狀態。我也嘗試運行inst.close();
函數,但那也沒用。重置頁面刷新狀態jQuery插件Remodal
這裏是我的代碼:
$(document).ready(function() {
var inst = $('[data-remodal-id=modal]').remodal();
console.log(inst.getState()); //if I refresh with the modal open this will print "opening".
//I want the modal to be closed every time the page is refreshed
$('#div').click(function() {
inst.open();
});
$(document).on('opening', '.remodal', function() {
//when the modal opens open another jQuery plugin
$("#gallery").unitegallery();
});
});
在我的HTML的身體,我有以下代碼:
<div data-remodal-id="modal"></div>