Skip to content

Commit 7891607

Browse files
committed
challenge 3 complete
1 parent 4148c9b commit 7891607

6 files changed

Lines changed: 33 additions & 94 deletions

File tree

‎exercises/01 - JavaScript Drum Kit/README.md‎

Whitespace-only changes.

‎exercises/02 - JS + CSS Clock/README.md‎

Whitespace-only changes.

‎exercises/03 - CSS Variables/README.md‎

Whitespace-only changes.

‎exercises/03 - CSS Variables/index-START.html‎

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,27 @@
11
<!DOCTYPE html>
22
<html lang="en">
3+
34
<head>
45
<meta charset="UTF-8">
56
<title>Scoped CSS Variables and JS</title>
6-
</head>
7-
<body>
8-
<h2>Update CSS Variables with <span class='hl'>JS</span></h2>
9-
10-
<div class="controls">
11-
<label for="spacing">Spacing:</label>
12-
<input type="range" name="spacing" min="10" max="200" value="10" data-sizing="px">
13-
14-
<label for="blur">Blur:</label>
15-
<input type="range" name="blur" min="0" max="25" value="10" data-sizing="px">
16-
17-
<label for="base">Base Color</label>
18-
<input type="color" name="base" value="#ffc600">
19-
</div>
20-
21-
<img src="https://source.unsplash.com/7bwQXzbF6KE/800x500">
227

238
<style>
249
:root {
25-
--base: #ffc600;
26-
--spacing: 10px;
10+
--base: goldenrod;
2711
--blur: 10px;
12+
--spacing: 10px;
2813
}
2914

3015
img {
31-
padding: var(--spacing);
3216
background: var(--base);
3317
filter: blur(var(--blur));
18+
padding: var(--spacing);
3419
}
3520

3621
.hl {
3722
color: var(--base);
3823
}
3924

40-
/*
41-
misc styles, nothing to do with CSS variables
42-
*/
43-
4425
body {
4526
text-align: center;
4627
}
@@ -66,19 +47,36 @@ <h2>Update CSS Variables with <span class='hl'>JS</span></h2>
6647
width:100px;
6748
}
6849
</style>
50+
</head>
6951

70-
<script>
71-
const inputs = document.querySelectorAll('.controls input');
52+
<body>
53+
<h2>Update CSS Variables with <span class='hl'>JS</span></h2>
7254

73-
function handleUpdate() {
74-
const suffix = this.dataset.sizing || '';
75-
document.documentElement.style.setProperty(`--${this.name}`, this.value + suffix);
76-
}
55+
<div class="controls">
56+
<label for="spacing">Spacing:</label>
57+
<input type="range" name="spacing" min="10" max="200" value="10" data-sizing="px">
7758

78-
inputs.forEach(input => input.addEventListener('change', handleUpdate));
79-
inputs.forEach(input => input.addEventListener('mousemove', handleUpdate));
80-
</script>
59+
<label for="blur">Blur:</label>
60+
<input type="range" name="blur" min="0" max="25" value="10" data-sizing="px">
8161

62+
<label for="base">Base Color</label>
63+
<input type="color" name="base" value="#ffc600">
64+
</div>
65+
66+
<img src="https://source.unsplash.com/7bwQXzbF6KE/800x500">
67+
68+
<script>
69+
const inputs = document.querySelectorAll('.controls input');
70+
71+
function handleUpdate() {
72+
const suffix = this.dataset.sizing || '';
73+
document.documentElement.style.setProperty(`--${this.name}`, this.value + suffix)
74+
}
75+
76+
inputs.forEach(input => input.addEventListener('change', handleUpdate));
77+
inputs.forEach(input => input.addEventListener('mousemove', handleUpdate));
78+
</script>
8279

8380
</body>
84-
</html>
81+
82+
</html>

‎readme.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# JavaScript30 - 30 Day JavaScript Challenge
2-
Course created by [Wes Bos](https://github.com/wesbos)
2+
Course created by [Wes Bos](https://github.com/wesbos)
33
Join the challenge (for free!) here - [JavaScript30](https://javascript30.com/account)
44

55
## About
@@ -21,7 +21,7 @@ The starter files include solutions to most challenges, so this isn't really mea
2121

2222
1. [x] ~~[JavaScript Drum Kit](./exercises/01\ -\ JavaScript\ Drum\ Kit)~~
2323
2. [x] ~~[JS + CSS Clock](./exercises/02\ -\ JS\ +\ CSS\ Clock/)~~
24-
3. [ ] CSS Variables
24+
3. [x] ~~[CSS Variables](./exercises/03\ -\ CSS\ Variables)~~
2525
4. [ ] Array Cardio, Day 1
2626
5. [ ] Flex Panel Gallery
2727
6. [ ] Type Ahead

0 commit comments

Comments
 (0)