_modals.scss 3.4 KB

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