Add a 'maxHeight' option to keep modals from extending past the screen. #67
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I encountered an issue with modals that contain more content than is viewable
on the screen, or are viewed in on a small screen/browser window.
To get around this, I've added an option called maxHeight, which limits the
vertical percentage of the screen that the modal will take up. It has a default
value of null, which results in the current behavior. If you set it to a
decimal (i.e. 0.90 for 90%), it will take the following actions:
the modal before applying centering logic
I've also updated the README and examples page accordingly.
There is one small issue introduced by maxHeight - the addition of overflow-y
may add a scroll bar to the modal, which can potentially cover up a close icon.
Since there's no way to place an element above the browser chrome, or other
universal positioning fix, handling this case is left as an exercise for the
user.
Intermediate commits:
Add example/test case
Add max-height if set, create handler to call resize on .resize event, still
need to figure out close icon
Update README.md accordingly
Re-minify with Closure Compiler with default options
We only need to set up maxheight and overflow properties on open(), not center()
Ensure positioning is fixed from the get-go and show element while we're centering (should not actually render)
Fix a little typo
Update minified js