You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_modal.scss 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. // .modal-open - body class for killing the scroll
  2. // .modal - container to scroll within
  3. // .modal-dialog - positioning shell for the actual modal
  4. // .modal-content - actual modal w/ bg and corners and shit
  5. // Kill the scroll on the body
  6. .modal-open {
  7. overflow: hidden;
  8. }
  9. // Container that the modal scrolls within
  10. .modal {
  11. position: fixed;
  12. top: 0;
  13. right: 0;
  14. bottom: 0;
  15. left: 0;
  16. z-index: $zindex-modal;
  17. display: none;
  18. overflow: hidden;
  19. // Prevent Chrome on Windows from adding a focus outline. For details, see
  20. // https://github.com/twbs/bootstrap/pull/10951.
  21. outline: 0;
  22. -webkit-overflow-scrolling: touch;
  23. // When fading in the modal, animate it to slide down
  24. &.fade .modal-dialog {
  25. transition: transform .3s ease-out;
  26. transform: translate(0, -25%);
  27. }
  28. &.in .modal-dialog { transform: translate(0, 0); }
  29. }
  30. .modal-open .modal {
  31. overflow-x: hidden;
  32. overflow-y: auto;
  33. }
  34. // Shell div to position the modal with bottom padding
  35. .modal-dialog {
  36. position: relative;
  37. width: auto;
  38. margin: 10px;
  39. }
  40. // Actual modal
  41. .modal-content {
  42. position: relative;
  43. background-color: $modal-content-bg;
  44. background-clip: padding-box;
  45. border: 1px solid $modal-content-border-color;
  46. border-radius: $border-radius-lg;
  47. @include box-shadow(0 3px 9px rgba(0,0,0,.5));
  48. // Remove focus outline from opened modal
  49. outline: 0;
  50. }
  51. // Modal background
  52. .modal-backdrop {
  53. position: fixed;
  54. top: 0;
  55. right: 0;
  56. bottom: 0;
  57. left: 0;
  58. z-index: $zindex-modal-bg;
  59. background-color: $modal-backdrop-bg;
  60. // Fade for backdrop
  61. &.fade { opacity: 0; }
  62. &.in { opacity: $modal-backdrop-opacity; }
  63. }
  64. // Modal header
  65. // Top section of the modal w/ title and dismiss
  66. .modal-header {
  67. padding: $modal-title-padding;
  68. border-bottom: 1px solid $modal-header-border-color;
  69. @include clearfix;
  70. }
  71. // Close icon
  72. .modal-header .close {
  73. margin-top: -2px;
  74. }
  75. // Title text within header
  76. .modal-title {
  77. margin: 0;
  78. line-height: $modal-title-line-height;
  79. }
  80. // Modal body
  81. // Where all modal content resides (sibling of .modal-header and .modal-footer)
  82. .modal-body {
  83. position: relative;
  84. padding: $modal-inner-padding;
  85. }
  86. // Footer (for actions)
  87. .modal-footer {
  88. padding: $modal-inner-padding;
  89. text-align: right; // right align buttons
  90. border-top: 1px solid $modal-footer-border-color;
  91. @include clearfix(); // clear it in case folks use .pull-* classes on buttons
  92. // Properly space out buttons
  93. .btn + .btn {
  94. margin-bottom: 0; // account for input[type="submit"] which gets the bottom margin like all other inputs
  95. margin-left: 5px;
  96. }
  97. // but override that for button groups
  98. .btn-group .btn + .btn {
  99. margin-left: -1px;
  100. }
  101. // and override it for block buttons as well
  102. .btn-block + .btn-block {
  103. margin-left: 0;
  104. }
  105. }
  106. // Measure scrollbar width for padding body during modal show/hide
  107. .modal-scrollbar-measure {
  108. position: absolute;
  109. top: -9999px;
  110. width: 50px;
  111. height: 50px;
  112. overflow: scroll;
  113. }
  114. // Scale up the modal
  115. @include media-breakpoint-up(sm) {
  116. // Automatically set modal's width for larger viewports
  117. .modal-dialog {
  118. width: $modal-md;
  119. margin: 30px auto;
  120. }
  121. .modal-content {
  122. @include box-shadow(0 5px 15px rgba(0,0,0,.5));
  123. }
  124. // Modal sizes
  125. .modal-sm { width: $modal-sm; }
  126. }
  127. @include media-breakpoint-up(md) {
  128. .modal-lg { width: $modal-lg; }
  129. }