Skip to content

Commit 53bf1eb

Browse files
committed
Day 3
1 parent 5123435 commit 53bf1eb

File tree

3 files changed

+15
-57
lines changed

3 files changed

+15
-57
lines changed

03 - CSS Variables/index-START.html

-51
This file was deleted.

03 - CSS Variables/index-FINISHED.html renamed to 03 - CSS Variables/index.html

+9-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<title>Scoped CSS Variables and JS</title>
66
</head>
77
<body>
8-
<h2>Update CSS Variables with <span class='hl'>JS</span></h2>
8+
<h2>Update CSS Variables with <span class='h1'>JS</span></h2>
99

1010
<div class="controls">
1111
<label for="spacing">Spacing:</label>
@@ -22,7 +22,7 @@ <h2>Update CSS Variables with <span class='hl'>JS</span></h2>
2222

2323
<style>
2424
:root {
25-
--base: #ffc600;
25+
--base:yellow;
2626
--spacing: 10px;
2727
--blur: 10px;
2828
}
@@ -33,8 +33,8 @@ <h2>Update CSS Variables with <span class='hl'>JS</span></h2>
3333
filter: blur(var(--blur));
3434
}
3535

36-
.hl {
37-
color: var(--base);
36+
.h1 {
37+
color:var(--base);
3838
}
3939

4040
/*
@@ -63,14 +63,17 @@ <h2>Update CSS Variables with <span class='hl'>JS</span></h2>
6363
const inputs = document.querySelectorAll('.controls input');
6464

6565
function handleUpdate() {
66+
// console.log(this.value);
6667
const suffix = this.dataset.sizing || '';
67-
document.documentElement.style.setProperty(`--${this.name}`, this.value + suffix);
68+
69+
document.documentElement.style.setProperty(`--${this.name}`, this.value +suffix);
70+
6871
}
6972

7073
inputs.forEach(input => input.addEventListener('change', handleUpdate));
7174
inputs.forEach(input => input.addEventListener('mousemove', handleUpdate));
72-
</script>
7375

76+
</script>
7477

7578
</body>
7679
</html>

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,9 @@
1414
* degree conversion
1515
* setInterval(function, timeout) to animate
1616

17+
## Day 3-CSS Controller @*Sept 17 2019*
18+
* :root -- root element of the document
19+
* in CSS, var(--some-name); then can be used as --some-name: some_value;
20+
* .forEach();
21+
* addEventListener('event',some_function)
22+
* add suffix e.g 'px' to a value and used in CSS property: documentElement.style.setProperty('target_property', add_some_value);

0 commit comments

Comments
 (0)