-
Notifications
You must be signed in to change notification settings - Fork 12
/
graaf.scss
69 lines (61 loc) · 1.86 KB
/
graaf.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
* Generate a fixed grid.
*/
@mixin generateFixedGrid($width, $columns, $gutter, $baseline) {
// Base image
$base_image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUCB1j6OvrMwEABTcB30rDe3EAAAAASUVORK5CYII=');
// The width of every column
$column_width: ($width - ($gutter * ($columns - 1))) / $columns;
// Generate required values. We are going to use the same image several times
// A fixed height is required to generate the Baseline
$height: 1440px;
$images: $base_image;
$positions: 0 0;
$sizes: $column_width 1px;
$repeats: repeat-y;
@for $col from 1 through ($columns - 1) {
// Position of the current column
$position: ($col * $column_width) + ($col * $gutter);
// Repeat image and positions
$images: $images, $base_image;
$positions: $positions, $position 0;
$sizes: $sizes, $column_width 1px;
$repeats: $repeats, repeat-y;
}
@if $baseline {
// Calculate the number of rows we need
$row_height: $gutter / 2;
$row_count: ($height / $row_height) / 2;
@for $row from 0 to $row_count {
$position: 2 * $row * $row_height;
$images: $images, $base_image;
$positions: $positions, 0 $position;
$repeats: $repeats, repeat-x;
$sizes: $sizes, 1px $row_height;
}
}
// BEGIN CSS CODE
// Disable the grid applying .no-grid class
body:not(.no-grid) {
margin: 0;
&:after {
content: '';
position: fixed;
// Will be enough?
z-index: 999999999;
// Center it
width: $width;
left: 50%;
margin-left: -($width / 2);
pointer-events: none;
// 100% of the user view height
top: 0;
height: 100vh;
background-image: $images;
background-position: $positions;
background-size: $sizes;
background-repeat: $repeats;
}
}
// END CSS CODE
}