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.

150 lines
3.4 KiB

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