- This topic is empty.
-
AuthorPosts
-
March 13, 2015 at 11:22 am #198074
cjcenizal
ParticipantI’ve implemented this modal using flexbox because I want a sticky header and footer. My solution works in Chrome and Firefox: http://codepen.io/cjcenizal/pen/JomaNo
Markup in Jade:
.blackout .flexModal .flexModal__inner .flexModal__header | Header .flexModal__body p Body content .flexModal__footer | Footer
SCSS:
.blackout { background-color: rgba(black, .5); position: fixed; width: 100%; height: 100%; top: 0; left: 0; display: flex; align-items: center; justify-content: center; } .flexModal { max-height: calc(100% - 40px); min-width: 400px; background-color: white; display: flex; flex-direction: column; } .flexModal__inner { min-height: 100%; display: flex; flex-direction: column; } .flexModal__header { display: flex; flex-shrink: 0; } .flexModal__body { flex-shrink: 1; overflow: auto; } .flexModal__footer { display: flex; flex-shrink: 0; }
The problem is that IE11 doesn’t render the modal correctly when it initially draws the page, and it doesn’t re-render it correctly when enlarging the window.
Here’s how it appears on first render. Notice how the footer isn’t visible? http://i.stack.imgur.com/SV9b2.png
When you make the window smaller, it re-renders correctly: http://i.stack.imgur.com/UHwB9.png
When you make the window bigger, it re-renders incorrectly: http://i.stack.imgur.com/gGuUw.png
Any suggestions about how to solve this or what the root cause is?
March 13, 2015 at 1:49 pm #198087Shikkediel
ParticipantA quick Google search turned up that IE needs explicit height set instead of min/max. Removing that from
.flexModel
and giving itheight: calc(100% - 100px);
seems to do the trick.March 13, 2015 at 1:51 pm #198088cjcenizal
ParticipantThanks, Shikkediel! That’s right, I’ve seen that too. I’ll update my original post to note that it’s important we use max-height, because that way the modal will shrink as the content in the scrollable area is reduced (otherwise it would look odd if the user has a tall window, with a tall, nearly empty modal, and a fixed footer).
March 14, 2015 at 12:29 am #198113Shikkediel
ParticipantAh yes, didn’t realise that. If you’re using JS you could throw some of that at it but I could imagine you wouldn’t want to.
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.