-
Notifications
You must be signed in to change notification settings - Fork 183
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 not user button? #128
Comments
I'm looking for similar functionality. Did you figure it out? |
I tried to fix the source but it failed! I had to trigger the submit button to open the modal, which was silly |
Have you tried $('.inline').modaal({
content_source: '#inline'
start_open: true
}); as per the docs? See: https://github.com/humaan/Modaal#32-programatically-open-a-modaal |
@pzi Yes, but I want to open the modal based on actions not when the website first loads. Something like they complete a form and then show up the modal if the form submits, as an example. |
CodePen example of triggering the form on form submit: HTML <form>
<label>
Foo
<input />
</label>
<button>Submit</button>
</form>
<div id="inline-content" class="trigger">...</div> CSS #inline-content {
display: none;
} JS // init modaal
$(".trigger").modaal({ content_source: "#inline-content" });
$("form").on("submit", (event) => {
event.preventDefault();
// open modaal on submit
$(".trigger").modaal("open");
}); Disclaimer: haven't used Modaal that much, so unsure if the "trigger" being on the same as the modaal content is legit, but it seems to work. Can always chuck the trigger class on another element if it's an issue. |
I want to use JQuery to open it but don't need any other buttons to open it.
Ex:
But not
It is stupid to have
<button class="inline">Show</button>
The text was updated successfully, but these errors were encountered: