This repository has been archived by the owner on Apr 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
modal.scss
96 lines (75 loc) · 1.74 KB
/
modal.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
.modal {
/* This way it could be display flex or grid or whatever also. */
display: block;
/* Probably need media queries here */
width: 80%;
max-width: 75rem;
height: 80%;
max-height: 100%;
position: fixed;
z-index: 100;
left: 50%;
top: 50%;
/* Use this for centering if unknown width/height */
transform: translate(-50%, -50%);
/* If known, negative margins are probably better (less chance of blurry text). */
/* margin: -200px 0 0 -200px; */
background: white;
box-shadow: 0 0 60px 10px rgba(0, 0, 0, 0.9);
&__content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 50px;
overflow-x: hidden;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
&__close {
position: absolute;
/* don't need to go crazy with z-index here, just sits over .modal__content */
z-index: 1;
top: 10px;
/* needs to look OK with or without scrollbar */
right: 20px;
border: 0;
background: black;
color: white;
padding: 5px 10px;
font-size: 1.3rem;
}
}
.modal-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 50;
background: rgba(0, 0, 0, 0.8);
display: none;
}
// Prevent overflow on HTML element
html {
//overflow-y: scroll;
-webkit-overflow-scrolling: touch; // Native scroll momentum
// To prevent jumping <body> should not have any margin on top or bottom
/*&.has-modal-overlay {
overflow: hidden;
height: auto;
> body {
height: 100%;
overflow: hidden;
}
}*/
}
.modal-overlay[aria-hidden="true"],
.modal[aria-hidden="true"] {
display: none;
}
.modal-overlay:not([aria-hidden="true"]),
.modal:not([aria-hidden="true"]) {
display: block;
}