Add parameters to define width and height for modal
See original GitHub issueHow to define variable width/height for modal? Looks like it can’t calculate things properly it these are used. Eg.: width: '50%'
, width: '5vw'
etc.
Furthermore, I think max-width
and max-height
are also important to have, especially for images.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to change Bootstrap Modal Width and Height - 3 Examples
In order to increase or decrease the modal window height and width properties of Bootstrap, you need to get the modal related classes...
Read more >Specify/Set width and height on a react-boostrap modal
I have checked the react-bootstrap docs here but could not figure out how to do that. Actually the value of width and height...
Read more >Bootstrap Modal Sizing - free examples & tutorial
Responsive popup window sizing with Bootstrap 5. Modal width, modal height, fullscreen modal, large modal with lg & xl modal classes and more....
Read more >Set width of modal window of lightning action
The "Large" modal changes width to occupy 90% of the viewport. It uses a wider minimum width and no maximum width. It's height...
Read more >Modal · Bootstrap v5.0
Use Bootstrap's JavaScript modal plugin to add dialogs to your site for ... Due to how HTML5 defines its semantics, the autofocus HTML...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@limonte I can think of a few use cases. With the additional parameters and event bindings that swal2 supports now, it’s becoming more than just a dialog modal. You could use swal2 to display videos or dynamic content, videos, iframes, images, etc. that it could be useful to have sized to a specific standard.
I do realize these use cases go beyond what the original use cases for what swal and swal2 were, but I don’t necessarily think that’s a bad thing.
Thoughts?
Important for mobile, fixed-widths usually will be cut on small screens. And having no
overflow: auto
, user can’t scroll modal contents using scrollbar, when contents are large; for example, a large image or an image withimageWidth
set too high. A good ability for a popup is to automatically adapt itself to the environment it is present, even if it is unknown. I see swal2 (maybe also original swal) usesmargin-left
and a px value for width to calculate its position…Instead, why doesn’t it calculate window.width, get its own width, then find the center? And because it is
position: fixed
, maybetop
andleft
values are the only things it needs to calculate for positioning itself. I think the title you set for this issue is not really accurate, while we can’t defineheight
we can already definewidth
, but as fixed pixels.