_reveal.scss 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. // Foundation by ZURB
  2. // foundation.zurb.com
  3. // Licensed under MIT Open Source
  4. @import 'global';
  5. @import 'grid';
  6. //
  7. // @name _reveal.scss
  8. // @dependencies _global.scss
  9. //
  10. $include-html-reveal-classes: $include-html-classes !default;
  11. // We use these to control the style of the reveal overlay.
  12. $reveal-overlay-bg: rgba($black, .45) !default;
  13. $reveal-overlay-bg-old: $black !default;
  14. // We use these to control the style of the modal itself.
  15. $reveal-modal-bg: $white !default;
  16. $reveal-position-top: rem-calc(100) !default;
  17. $reveal-default-width: 80% !default;
  18. $reveal-max-width: $row-width !default;
  19. $reveal-modal-padding: rem-calc(30) !default;
  20. $reveal-box-shadow: 0 0 10px rgba($black,.4) !default;
  21. // We use these to style the reveal close button
  22. $reveal-close-font-size: rem-calc(40) !default;
  23. $reveal-close-top: rem-calc(10) !default;
  24. $reveal-close-side: rem-calc(22) !default;
  25. $reveal-close-color: $base !default;
  26. $reveal-close-weight: $font-weight-bold !default;
  27. // We use this to set the default radius used throughout the core.
  28. $reveal-radius: $global-radius !default;
  29. $reveal-round: $global-rounded !default;
  30. // We use these to control the modal border
  31. $reveal-border-style: solid !default;
  32. $reveal-border-width: 1px !default;
  33. $reveal-border-color: $steel !default;
  34. $reveal-modal-class: "reveal-modal" !default;
  35. $close-reveal-modal-class: "close-reveal-modal" !default;
  36. // Set base z-index
  37. $z-index-base: 1005;
  38. //
  39. // @mixins
  40. //
  41. // We use this to create the reveal background overlay styles
  42. @mixin reveal-bg( $include-z-index-value: true ) {
  43. // position: absolute; // allows modal background to extend beyond window position
  44. background: $reveal-overlay-bg-old; // Autoprefixer should be used to avoid such variables needed when Foundation for Sites can do so in the near future.
  45. background: $reveal-overlay-bg;
  46. bottom: 0;
  47. display: none;
  48. left: 0;
  49. position: fixed;
  50. right: 0;
  51. top: 0;
  52. z-index: if( $include-z-index-value, $z-index-base - 1, auto );
  53. #{$default-float}: 0;
  54. }
  55. // We use this mixin to create the structure of a reveal modal
  56. //
  57. // $base-style - Provides reveal base styles, can be set to false to override. Default: true, Options: false
  58. // $width - Sets reveal width Default: $reveal-default-width || 80%
  59. //
  60. @mixin reveal-modal-base( $base-style: true, $width:$reveal-default-width, $max-width:$reveal-max-width, $border-radius: $reveal-radius) {
  61. @if $base-style {
  62. border-radius: $border-radius;
  63. display: none;
  64. position: absolute;
  65. top:0;
  66. visibility: hidden;
  67. width: 100%;
  68. z-index: $z-index-base;
  69. #{$default-float}: 0;
  70. @media #{$small-only} {
  71. min-height:100vh;
  72. }
  73. // Make sure rows don't have a min-width on them
  74. .column, .columns { min-width: 0; }
  75. // Get rid of margin from first and last element inside modal
  76. > :first-child { margin-top: 0; }
  77. > :last-child { margin-bottom: 0; }
  78. }
  79. @if $width {
  80. @media #{$medium-up} {
  81. left: 0;
  82. margin: 0 auto;
  83. max-width: $max-width;
  84. right: 0;
  85. width: $width;
  86. }
  87. }
  88. }
  89. // We use this to style the reveal modal defaults
  90. //
  91. // $bg - Sets background color of reveal modal. Default: $reveal-modal-bg || $white
  92. // $padding - Padding to apply to reveal modal. Default: $reveal-modal-padding.
  93. // $border - Choose whether reveal uses a border. Default: true, Options: false
  94. // $border-style - Set reveal border style. Default: $reveal-border-style || solid
  95. // $border-width - Width of border (i.e. 1px). Default: $reveal-border-width.
  96. // $border-color - Color of border. Default: $reveal-border-color.
  97. // $box-shadow - Choose whether or not to include the default box-shadow. Default: true, Options: false
  98. // $radius - If true, set to modal radius which is $global-radius || explicitly set radius amount in px (ex. $radius:10px). Default: false
  99. // $top-offset - Default: $reveal-position-top || 50px
  100. @mixin reveal-modal-style(
  101. $bg:false,
  102. $padding:false,
  103. $border:false,
  104. $border-style:$reveal-border-style,
  105. $border-width:$reveal-border-width,
  106. $border-color:$reveal-border-color,
  107. $box-shadow:false,
  108. $radius:false,
  109. $top-offset:false) {
  110. @if $bg { background-color: $bg; }
  111. @if $padding != false { padding: $padding; }
  112. @if $border { border: $border-style $border-width $border-color; }
  113. // We can choose whether or not to include the default box-shadow.
  114. @if $box-shadow {
  115. box-shadow: $reveal-box-shadow;
  116. }
  117. @else{
  118. box-shadow: none;
  119. }
  120. // We can control how much radius is used on the modal
  121. @if $radius == true { @include radius($reveal-radius); }
  122. @else if $radius { @include radius($radius); }
  123. @if $top-offset {
  124. @media #{$medium-up} {
  125. top: $top-offset;
  126. }
  127. }
  128. }
  129. // We use this to create a close button for the reveal modal
  130. //
  131. // $color - Default: $reveal-close-color || $base
  132. @mixin reveal-close($color:$reveal-close-color) {
  133. color: $color;
  134. cursor: $cursor-pointer-value;
  135. font-size: $reveal-close-font-size;
  136. font-weight: $reveal-close-weight;
  137. line-height: 1;
  138. position: absolute;
  139. top: $reveal-close-top;
  140. #{$opposite-direction}: $reveal-close-side;
  141. }
  142. @include exports("reveal") {
  143. @if $include-html-reveal-classes {
  144. // Reveal Modals
  145. .reveal-modal-bg { @include reveal-bg; }
  146. .#{$reveal-modal-class} {
  147. @include reveal-modal-base;
  148. @include reveal-modal-style(
  149. $bg:$reveal-modal-bg,
  150. $padding:$reveal-modal-padding,
  151. $border:true,
  152. $box-shadow:true,
  153. $radius:false,
  154. $top-offset:$reveal-position-top
  155. );
  156. &.radius { @include reveal-modal-style($radius:true); }
  157. &.round { @include reveal-modal-style($radius:$reveal-round); }
  158. &.collapse { @include reveal-modal-style($padding:0); }
  159. &.tiny { @include reveal-modal-base(false, 30%); }
  160. &.small { @include reveal-modal-base(false, 40%); }
  161. &.medium { @include reveal-modal-base(false, 60%); }
  162. &.large { @include reveal-modal-base(false, 70%); }
  163. &.xlarge { @include reveal-modal-base(false, 95%); }
  164. &.full {
  165. @include reveal-modal-base(false, 100%);
  166. height: 100vh;
  167. height:100%;
  168. left:0;
  169. margin-left: 0 !important;
  170. max-width: none !important;
  171. min-height:100vh;
  172. top:0;
  173. }
  174. // Modals pushed to back
  175. &.toback {
  176. z-index: $z-index-base - 2;
  177. }
  178. .#{$close-reveal-modal-class} { @include reveal-close; }
  179. }
  180. }
  181. }