-
Notifications
You must be signed in to change notification settings - Fork 663
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
Avoid having to set inline styles to hide modal by default #186
Comments
The workaround I found to this was setting |
@Accomp Trouble is it would still take up space on the page and leave a big white blank area. |
A workaround for this is wrapping the modal inside an element whose <section class="modal-wrapper">
<section id="form-errors" class="modal">
<section class="error-container">
<h4>Some of the input is invalid, please see below for details.</h4>
<ul></ul>
</section>
</section>
</section> .modal-wrapper {
display: none;
} This means that the modal is both not shown and is not taking any space, but will be correctly displayed once opened. |
Yep, you'd still need to hide the original content if you're writing it out on the page. The shown modal content is just a duplication of that in the bottom of the DOM. |
I agree, this isn't ideal. Elements on the page with class Whatever the approach is, it should be backwards compatible. Perhaps the safest thing to do is:
Thoughts? |
Sounds good, just don't forget you will obviously also need to remove the inline style |
Sounds good, although I'd side with the addition of the |
I'm under the impression this hasn't been fixed yet? |
I just downloaded and used the script and had the same issue. Has not been fixed yet and @smirnowld's fix worked easiest for me; just use a wrapper. That being said, it is very strange that a modal package would not come with it's modal pre-hidden. fwiw. |
@kylefox - this would be pretty easy to fix. Just attach the following to whatever event fires on page load:
This is exactly what I do as an override. |
I have just started using this and everything was working fine, but then noticed the modal was showing on the page by default (right down the bottom); shouldn't the modal be hidden by default!?
This is caused by the
display: inline-block;
style in the.modal
class.I tried fiddling around a bit but nothing seems to work perfectly unless you set an inline-style for the element with the
.modal
class todisplay: none;
.This is a great modal script, but having to manually set an inline-style on every modal you have isn't so great.
Apologies if you don't have to do this and I'm doing something wrong here, but I checked your examples page and that's how you were doing it as well.
The text was updated successfully, but these errors were encountered: