-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyle.css
111 lines (95 loc) · 2.4 KB
/
style.css
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
* {
box-sizing: border-box;
}
body {
font-family: sans-serif;
margin-top: 2rem;
}
.events-container {
margin-top: 3rem;
}
.events-title {
font-size: 2rem;
margin: 0;
}
.event-text {
background-color: var(--bg-clr);
font-size: 1.25rem;
white-space: nowrap;
}
.container {
margin: auto;
max-width: 20rem;
}
.btns-container {
display: flex;
flex-direction: column;
gap: 3rem;
justify-content: center;
align-items: center;
max-width: 20rem;
margin: auto;
}
[data-btn="css-transition"] {
--bg-clr: hsl(50, 85%, 90%);
--hover-clr: hsl(50, 85%, 80%);
--fill-clr: hsl(50, 85%, 70%);
}
[data-btn="animationFrame-css-transform"] {
--bg-clr: hsl(100, 85%, 90%);
--hover-clr: hsl(100, 85%, 80%);
--fill-clr: hsl(100, 85%, 70%);
}
[data-btn="animationFrame-css-transition"] {
--bg-clr: hsl(0, 85%, 90%);
--hover-clr: hsl(0, 85%, 80%);
--fill-clr: hsl(0, 85%, 70%);
}
.click-and-hold {
position: relative;
display: flex;
justify-content: center;
align-items: center;
z-index: 10;
max-width: 100%;
padding: 1em;
border: 1px solid rgb(0 0 0 / 0.2);
border-radius: 5px;
box-shadow: 0px 2px 10px 1px rgb(0 0 0 / 0.5);
background-color: var(--bg-clr);
overflow: hidden;
cursor: pointer;
}
@media (hover:hover) {
.click-and-hold:hover {
background-color: var(--hover-clr);
}
}
.click-and-hold .fill {
position: absolute;
z-index: -1;
inset: 0 -100%;
width: 100%;
height: 100%;
background-color: var(--fill-clr);
transform: translateX(0);
}
.click-and-hold .text {
text-align: center;
font-size: 1.5rem;
}
.click-and-hold[data-active-hold] {
position: relative;
top: 3px;
box-shadow: 0px 2px 4px 1px rgb(0 0 0 / 0.5);
}
/* Animation using (animation.js or animationFrame.js) + CSS transition */
[data-btn="css-transition"].click-and-hold[data-active-hold] .fill,
[data-btn="animationFrame-css-transition"].click-and-hold[data-active-hold] .fill {
transition: transform var(--hold-duration) linear;
transform: translateX(100%);
}
/* Animation using animationFrame.js + CSS transform */
[data-btn="animationFrame-css-transform"].click-and-hold[data-active-hold] .fill {
transform: translateX(var(--complete-percent));
}