Closed katag9k closed 8 years ago
Just to be clear, you're passing the options to element.remodal(options)
?
If that's the case, a fiddle would help.
Fiddle won't show the issue because you cannot reload it.
Here is a test page: http://test.kaygee.ca/modal.html
Click on the link, it populates the modal text and opens the modal. Reload the page, the modal opens and is blank. The issue: on reload I don't want the modal to launch automatically. I thought by turning hashTracking: false
the hashtag wouldn't appear in the URL bar, thus the modal would not open on browser refresh.
Having the same issue.
What happens if you move the remodal initialization out of the click-event?
var options = {hashTracking: false};
var modal = $( '[data-remodal-id=modal]' ).remodal( options );
$('#go-modal').click(function() {
$('.remodal p').html('Dynamic text inserted via JavaScript');
modal.open();
});
That should be executed after DOM is fully loaded, obviously.
I think what's happening is that Remodal sees the hash, and since the element in question hasn't been explicitly initialized with hashTracking: false
yet (you do that only after the link is clicked), it will open the modal.
using JavaScript to open the modal, I don't want the hash to appear in the url as upon reload the dynamically populated modal comes up blank.
using
var options = {hashTracking: false};
withmodal.open();
but url still appears with http://mydomian.com/#modalCan the hash be omitted from the url?