File tree 3 files changed +15
-57
lines changed
3 files changed +15
-57
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 5
5
< title > Scoped CSS Variables and JS</ title >
6
6
</ head >
7
7
< 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 >
9
9
10
10
< div class ="controls ">
11
11
< label for ="spacing "> Spacing:</ label >
@@ -22,7 +22,7 @@ <h2>Update CSS Variables with <span class='hl'>JS</span></h2>
22
22
23
23
< style >
24
24
: root {
25
- --base : # ffc600 ;
25
+ --base : yellow ;
26
26
--spacing : 10px ;
27
27
--blur : 10px ;
28
28
}
@@ -33,8 +33,8 @@ <h2>Update CSS Variables with <span class='hl'>JS</span></h2>
33
33
filter : blur (var (--blur ));
34
34
}
35
35
36
- .hl {
37
- color : var (--base );
36
+ .h1 {
37
+ color : var (--base );
38
38
}
39
39
40
40
/*
@@ -63,14 +63,17 @@ <h2>Update CSS Variables with <span class='hl'>JS</span></h2>
63
63
const inputs = document . querySelectorAll ( '.controls input' ) ;
64
64
65
65
function handleUpdate ( ) {
66
+ // console.log(this.value);
66
67
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
+
68
71
}
69
72
70
73
inputs . forEach ( input => input . addEventListener ( 'change' , handleUpdate ) ) ;
71
74
inputs . forEach ( input => input . addEventListener ( 'mousemove' , handleUpdate ) ) ;
72
- </ script >
73
75
76
+ </ script >
74
77
75
78
</ body >
76
79
</ html >
Original file line number Diff line number Diff line change 14
14
* degree conversion
15
15
* setInterval(function, timeout) to animate
16
16
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);
You can’t perform that action at this time.
0 commit comments