-
Notifications
You must be signed in to change notification settings - Fork 2
/
_include-media-hidden-classes.scss
41 lines (35 loc) · 1.06 KB
/
_include-media-hidden-classes.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$im-num-breakpoints: length($breakpoints);
$im-hidden-important: false !default;
$im-hidden-class: "hidden" !default;
@mixin im-hidden($type, $breakpoint) {
.#{$im-hidden-class}--#{$type}-#{$breakpoint} {
@if $im-hidden-important == false {
display: none;
} @else {
display: none !important;
}
}
}
@for $i from 1 through $im-num-breakpoints {
$breakpoint: nth($breakpoints, $i);
$breakpoint-name: nth($breakpoint, 1);
@if $i == $im-num-breakpoints {
@include media('>=#{$breakpoint-name}') {
@include im-hidden('for', $breakpoint-name);
}
} @else {
$next-breakpoint: nth($breakpoints, $i + 1);
$next-breakpoint-name: nth($next-breakpoint, 1);
@include media('>=#{$breakpoint-name}', '<#{$next-breakpoint-name}') {
@include im-hidden('for', $breakpoint-name);
}
}
@if $i != $im-num-breakpoints {
@include media('>=#{$breakpoint-name}') {
@include im-hidden('from', $breakpoint-name);
}
}
@include media('<#{$breakpoint-name}') {
@include im-hidden('to', $breakpoint-name);
}
}