I am using the jQuery plugin Remodal to create a modal for my website. I am following the documentation on their website however I am running into an issue with opening and closing the modal. If I open the modal then refresh my browser the next time the page loads the modal will still be open. I created an instance of the modal using var inst = $('[data-remodal-id=modal]').remodal();
and did a console.log(inst.getState());
and the modal was stuck in in the "opening" state. I also tried to run the inst.close();
function but that didnt work as well.
Here is my code:
$(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();
});
});
Within my html body I have the following code:
<div data-remodal-id="modal"></div>