New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to open modal on page load? #46
Comments
You can load it by opening a url with fragment identifier. I.e. somesite.com/#modal1 for example. |
That makes sense. I was thinking more along the lines of arbitrarily opening it up on a page load regardless of which link they click on. For example, have the modal open on the 4th page load by a site visitor. Is there a way to set that #modal1 fragment identifie using javascript when the page loads? Thanks for the help, I appreciate it. |
You could do something like |
I was able to figure out how to make it work with your suggestion. This is going to help with something I'm working on, really appreciate the tip, thanks! |
I just ran into an issue with this. In firefox when I change the hash, the modal doesn't automatically pop up. The other browsers work as expected. Perhaps I'm not doing it right. In the head I have this (sm is the id of the modal): <script type="text/javascript">window.location.hash = "sm";</script> </script> <script src="js/modal.js"></script>It's a very simple setup but even though #sm is being added to the URL, the modal doesn't automatically pop up. It will come up if I reload the URL with the #sm on it. Any ideas? |
Head example didn't come through, I'll try indenting it.
|
Thanks for the additional details. As I am able to confirm this, I now reopen the issue. A bugfix is coming soon! For the time being you can fix this by extending the
As the |
That worked! I went into the css file and found every instance of :target and basic went from this:
to this:
Thanks a lot for the help, it's very much appreciated. |
This targets #46. Please close the issue if that is a complete valid fix.
The fix landed. Thanks :) |
Is there a way to open the model on page load instead of by clicking a link?
(this isn't an "issue" but I'm not sure how to post a question, sorry if I broke protocol)
The text was updated successfully, but these errors were encountered: