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
Fix modal vertical align #91
base: master
Are you sure you want to change the base?
Conversation
I noticed `#instructions_modal` was not displaying properly on smaller screens. It was not vertically center-aligned, and it had an awkward scrollbar. To fix this, I removed `margin-top: 200px` from the modal and added a function to dynamically set margin-top based on window.height().
hey @tylerburleigh ! This is a great idea, but I don't want to add an entire new javascript library dependency just to tweak a style. Can you figure out an adjustment that doesn't require this? Meaning, css only, so you can add a class to define the modal, and then customize it (and possibly set a custom value for resolution less than some size). |
I think the best CSS-only solution is to simply remove the What's the issue with adding a js dependency? Would including the JS code inside each of the start.html, finish.html, and entry.html files be a better solution? If you are concerned about it mucking with other elements, then I could modify the JS code to target that specific modal's DOM ID. |
Take a look at libraries that define css properties based on the max-width, media (max width) eg see here: And for css sizes, you can also do percentages, so to respond to your statement directly:
Yeah, I prefer the centered look than top aligned!
Most of the time I've seen these, there are several options. I would say having media queries for at least a few of the most likely resolutions (and maybe one imperfect) is better than having (more than one?) imperfect as you are seeing.
It's generally best practice to keep dependencies to a minimal. It's also better practice to not add unnecessary javascript - it ultimately leads to an overly engineered thing. For essential functions (jquery) or established libraries (bootstrap) it's important to include, and when there are changes to the library (let's say some day we decide to do the work to update bootstrap) you wouldn't want to have many custom tweaks to have to redo. This is the same rationale for any software library - you install a particular version and don't then customize it on your server. Thus, for these larger / important and established libraries, I would include. But for trivial things like changing the position of a modal? You don't need javascript for that. Adding it might be easier, but it is not the right approach for long term health of the codebase.
It would be less ideal, because then you are copy pasting the same thing.
Nope, definitely not! I really like this suggestion to work on the style and I'd like to help you, and I think we should give media queries a try. Do you want to take a shot? |
Alright, I found a CSS-based solution that doesn't use media queries so it can adapt to any viewport height. It involves overriding a few of bootstrap's CSS properties for |
This reverts commit 3c75839.
Description of the Pull Request (PR):
I noticed
#instructions_modal
was not displaying properly on smaller screens. It was not vertically center-aligned, and it had an awkward scrollbar.To fix this, I removed
margin-top: 200px
from the modal and added a function to dynamically set margin-top based on window.height().This fixes or addresses the following GitHub issues:
Checkoff for all PRs:
Attn: @expfactory-admin