Skip to content

Commit a7b65f0

Browse files
committed
Fixes blur variable and adds JS solution
1 parent 1671fef commit a7b65f0

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

03 - CSS Variables/scripts.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const inputs = document.querySelectorAll('.controls input');
2+
3+
function handleUpdate(params) {
4+
// console.log(this.value);
5+
6+
const suffix = this.dataset.sizing || '';
7+
// console.log(suffix);
8+
9+
// console.log(this.name);
10+
document.documentElement.style.setProperty(`--${this.name}`, this.value + suffix);
11+
}
12+
13+
inputs.forEach(input => input.addEventListener('change', handleUpdate));
14+
inputs.forEach(input => input.addEventListener('mousemove', handleUpdate));
15+

03 - CSS Variables/style.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,19 @@
1010
img {
1111
padding: var(--spacing);
1212
background: var(--base);
13-
filter: blur(--blur);
13+
filter: blur(var(--blur));
1414
}
1515

1616
.hl {
1717
color: var(--base);
1818
}
1919

20+
#base {
21+
margin: 0;
22+
padding: 0;
23+
border: none;
24+
}
25+
2026
body {
2127
text-align: center;
2228
background: #193549;

0 commit comments

Comments
 (0)