-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
41 lines (28 loc) · 1.06 KB
/
main.js
File metadata and controls
41 lines (28 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
let outputCode = document.getElementById("css-code");
let sliders = document.querySelectorAll("input[type='range']");
sliders.forEach(function (slider) {
slider.addEventListener("input", createBox);
});
let color = document.querySelectorAll("input[type='color']"); {
color.forEach(function (colors) {
colors.addEventListener("change", createBox);
});
}
function createBox() {
let X = sliders[0].value;
let Y = sliders[1].value;
let blurRadius = sliders[2].value;
let spreadRadius = sliders[3].value;
let shadowcolor = color[0].value;
let boxShadow = `${X}px ${Y}px ${blurRadius}px ${spreadRadius}px`;
document.getElementById("box").style.cssText = `box-shadow: ${boxShadow} ${shadowcolor}`;
outputCode.value = `box-shadow: ${boxShadow} ${shadowcolor};`
}
let output = document.getElementById("css-code");
let btnCopy = document.getElementById("copy");
btnCopy.onclick = function () {
output.select();
document.execCommand("Copy");
alert("Code Copied");
}
createBox();