-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
21 lines (17 loc) · 734 Bytes
/
Copy pathscript.js
File metadata and controls
21 lines (17 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const body = document.querySelector('body');
const color1 = document.querySelector("#color1");
const color2 = document.querySelector("#color2");
const css = document.querySelector("h3");
const fontColor = document.querySelector("#fontColor");
const options = document.querySelector('select');
function colorChange() {
body.style.background = `linear-gradient(${options.value}, ${color1.value},${color2.value})`;
css.textContent = body.style.background + ";";
}
console.log(color1.value);
color1.addEventListener("input", colorChange);
color2.addEventListener("input", colorChange);
options.addEventListener("input", colorChange);
fontColor.addEventListener("input", function () {
body.style.color = fontColor.value;
})