Created
September 19, 2019 10:45
-
-
Save quantumwebco/a08c94e1d1b6dc6e19ca93d370e1cd66 to your computer and use it in GitHub Desktop.
A Sass snippet to make bootstrap modals more mobile friendly by turning them into a 'bottom sheet' on smaller screens
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.modal { | |
display: flex; | |
align-items: flex-end; | |
&.fade { | |
.modal-dialog-bottom { | |
position: absolute; | |
bottom: 0; | |
transition: transform 0.4s; | |
transform: translate(0, 100%); | |
margin: 0 auto 0; | |
left: 0; | |
right: 0; | |
max-height: 100vh; | |
@media (min-width: 767.98px) { | |
bottom: 50%; | |
transform: translate(0, 50%); | |
} | |
.modal-content { | |
overflow-y: visible; | |
border-radius: 0; | |
} | |
} | |
} | |
&.show { | |
.modal-dialog-bottom { | |
transform: translate(0, 0); | |
@media (min-width: 767.98px) { | |
transform: translate(0, 50%); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment