Comments (9)
You can load it by opening a url with fragment identifier. I.e. somesite.com/#modal1 for example.
from css-modal.
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.
from css-modal.
You could do something like location.hash = "modal1";
. Wrap it in any (callback) function you want to.
from css-modal.
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!
from css-modal.
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?
from css-modal.
Head example didn't come through, I'll try indenting it.
<script type="text/javascript">window.location.hash = "sm";</script>
<link rel="stylesheet" href="css/modal.css"></script>
<script src="js/modal.js"></script>
from css-modal.
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 :target
selectors by:
&:target,
&.is-active {
…
}
As the .is-active
class is set by the js this will then trigger your modal on load.
from css-modal.
That worked! I went into the css file and found every instance of :target and basic went from this:
.semantic-content:target {
display: block\9;
}
to this:
.semantic-content:target, .semantic-content.is-active {
display: block\9;
}
Thanks a lot for the help, it's very much appreciated.
from css-modal.
The fix landed. Thanks :)
from css-modal.
Related Issues (20)
- Strange scrolling bug HOT 2
- Drop IE8 and Android 2 with next version HOT 1
- data-iframe-src HOT 1
- Scrolling issue on Android 5.0 HOT 3
- Namespace data-attributes
- Incorrect function calls - modal.js HOT 1
- <iframe> breaks the js HOT 2
- Question: modal height when using more than one div and JS
- AMD pattern nested inside
- Closing stackable modals
- ".modal-content" spacing inconsistencies
- Release latest version on npm HOT 1
- modal w/form & input fields shifts out of view when keyboard opens [iPhone-only] HOT 2
- Event handlers not registering properly
- Unnecessary scrollbar HOT 2
- Download v1.4.0 HOT 4
- html overflow property HOT 1
- video keeps playing after close HOT 5
- cssmodal:show / cssmodal:hide dialog reference in event HOT 2
- css bug! HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from css-modal.