|
102 | 102 | }, false ); |
103 | 103 | } |
104 | 104 | document.querySelector("button").addEventListener( "click", () => { |
105 | | - setTimeout(function () { |
| 105 | + setTimeout(() => { |
106 | 106 | changeCSS(); |
107 | 107 | }, 50); |
108 | 108 | }, |
|
123 | 123 | sepia() |
124 | 124 | ); |
125 | 125 | } |
126 | | - /* blur()*/ |
| 126 | + |
127 | 127 | function blur() { |
128 | | - let blurValue = document.getElementsByName("blur")[0]; |
129 | | - return "blur(" + blurValue.value + "rem) "; |
| 128 | + const blurValue = document.getElementsByName("blur")[0]; |
| 129 | + return `blur(${blurValue.value}rem) `; |
130 | 130 | } |
131 | | - /* brightness()*/ |
| 131 | + |
132 | 132 | function brightness() { |
133 | | - let brightnessValue = document.getElementsByName("brightness")[0]; |
134 | | - return "brightness(" + brightnessValue.value + ") "; |
| 133 | + const brightnessValue = document.getElementsByName("brightness")[0]; |
| 134 | + return `brightness(${brightnessValue.value}) `; |
135 | 135 | } |
136 | | - /* contrast()*/ |
| 136 | + |
137 | 137 | function contrast() { |
138 | | - let contrastValue = document.getElementsByName("contrast")[0]; |
139 | | - return "contrast(" + contrastValue.value + ") "; |
| 138 | + const contrastValue = document.getElementsByName("contrast")[0]; |
| 139 | + return `contrast(${contrastValue.value}) `; |
140 | 140 | } |
141 | | - /* drop-shadow()*/ |
| 141 | + |
142 | 142 | function dropShadow() { |
143 | | - let dropShadowValue = document.getElementsByName("dropShadow")[0]; |
144 | | - return ( |
145 | | - "drop-shadow(" + dropShadowValue.value + |
146 | | - "rem " + dropShadowValue.value + "rem " + "0rem orange) " |
147 | | - ); |
| 143 | + const dropShadowValue = document.getElementsByName("dropShadow")[0]; |
| 144 | + return `drop-shadow(${dropShadowValue.value}rem ${dropShadowValue.value}rem 0rem orange) `; |
148 | 145 | } |
149 | | - /* grayscale()*/ |
| 146 | + |
150 | 147 | function grayscale() { |
151 | | - let grayscaleValue = document.getElementsByName("grayscale")[0]; |
152 | | - return "grayscale(" + grayscaleValue.value + ") "; |
| 148 | + const grayscaleValue = document.getElementsByName("grayscale")[0]; |
| 149 | + return `grayscale(${grayscaleValue.value}) `; |
153 | 150 | } |
154 | | - /* hue-rotate()*/ |
| 151 | + |
155 | 152 | function hueRotate() { |
156 | | - let hueRotateValue = document.getElementsByName("hueRotate")[0]; |
157 | | - return "hue-rotate(" + hueRotateValue.value + "turn) "; |
| 153 | + const hueRotateValue = document.getElementsByName("hueRotate")[0]; |
| 154 | + return `hue-rotate(${hueRotateValue.value}turn) `; |
158 | 155 | } |
159 | | - /* invert()*/ |
| 156 | + |
160 | 157 | function invert() { |
161 | | - let invertValue = document.getElementsByName("invert")[0]; |
162 | | - return "invert(" + invertValue.value + ") "; |
| 158 | + const invertValue = document.getElementsByName("invert")[0]; |
| 159 | + return `invert(${invertValue.value) `; |
163 | 160 | } |
164 | | - /* opacity()*/ |
| 161 | +
|
165 | 162 | function opacity() { |
166 | | - let opacityValue = document.getElementsByName("opacity")[0]; |
167 | | - return "opacity(" + opacityValue.value + ") "; |
| 163 | + const opacityValue = document.getElementsByName("opacity")[0]; |
| 164 | + return `opacity(${opacityValue.value}) `; |
168 | 165 | } |
169 | | - /* saturate()*/ |
| 166 | + |
170 | 167 | function saturate() { |
171 | | - let saturateValue = document.getElementsByName("saturate")[0]; |
172 | | - return "saturate(" + saturateValue.value + ") "; |
| 168 | + const saturateValue = document.getElementsByName("saturate")[0]; |
| 169 | + return `saturate(${saturateValue.value}) `; |
173 | 170 | } |
174 | | - /* sepia()*/ |
| 171 | + |
175 | 172 | function sepia() { |
176 | | - let sepiaValue = document.getElementsByName("sepia")[0]; |
177 | | - return "sepia(" + sepiaValue.value + ") "; |
| 173 | + const sepiaValue = document.getElementsByName("sepia")[0]; |
| 174 | + return `sepia(${sepiaValue.value}) `; |
178 | 175 | } |
179 | 176 | </script> |
180 | 177 | <p>Image by <cite>DigitalNomad</cite></p> |
|
0 commit comments