Skip to content

Commit 1118ea9

Browse files
committed
implimented handleUpdate
1 parent e7e7f12 commit 1118ea9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

03 - CSS Variables/index-START.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,14 @@ <h2>Update CSS Variables with <span class="hl">JS</span></h2>
7979
const inputs = document.querySelectorAll('.controls input')
8080

8181
function handleUpdate() {
82-
console.log(this.value)
82+
const suffix = this.dataset.sizing || ''
83+
document.documentElement.style.setProperty(
84+
`--${this.name}`,
85+
this.value + suffix
86+
)
8387
}
8488
inputs.forEach(input => input.addEventListener('change', handleUpdate))
89+
inputs.forEach(input => input.addEventListener('mousemove', handleUpdate))
8590
</script>
8691
</body>
8792
</html>

0 commit comments

Comments
 (0)