Skip to content

Commit

Permalink
Merge pull request #7092 from michael-wilson/patch-1
Browse files Browse the repository at this point in the history
Update _visibility.scss
  • Loading branch information
gakimball committed Nov 21, 2015
2 parents 06118d3 + f321207 commit c5fe6c9
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions scss/components/_visibility.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,30 @@
/// Hide an element by default, only displaying it within a certain breakpoint.
/// @param {Keyword} $size - Breakpoint to use. **Must be a breakpoint defined in `$breakpoints`.**
@mixin show-for-only($size) {
$lower-bound: -zf-bp-to-em(map-get($breakpoints, $size)) - (1/16);
$upper-bound: -zf-bp-to-em(-zf-map-next($breakpoints, $size));
$lower-bound-size: map-get($breakpoints, $size);
$upper-bound-size: -zf-map-next($breakpoints, $size);

// more often than not this will be correct, just one time round the loop it won't so set in scope here
$lower-bound: -zf-bp-to-em($lower-bound-size) - (1/16);
// test actual lower-bound-size, if 0 set it to 0em
@if $lower-bound-size == 0 {
$lower-bound: -zf-bp-to-em($lower-bound-size);
}

@media screen and (max-width: $lower-bound), screen and (min-width: $upper-bound) {
display: none !important;
@if $upper-bound-size == null {
@media screen and (max-width: $lower-bound) {
display: none !important;
}
}
@else {
$upper-bound: -zf-bp-to-em($upper-bound-size);
@media screen and (max-width: $lower-bound), screen and (min-width: $upper-bound) {
display: none !important;
}
}
}


/// Show an element by default, and hide it above a certain screen size.
/// @param {Keyword} $size - Breakpoint to use. **Must be a breakpoint defined in `$breakpoints`.**
@mixin hide-for($size) {
Expand Down

0 comments on commit c5fe6c9

Please sign in to comment.