-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsquare-box.js
71 lines (64 loc) · 2.62 KB
/
square-box.js
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
let Width = document.getElementById("Width");
let Height = document.getElementById("Height");
let Radius = document.getElementById("Radius");
let Color = document.getElementById("Color");
let OX = document.getElementById("offsetX");
let OY = document.getElementById("offsetY");
let BR = document.getElementById("BlurR");
let SR = document.getElementById("SpreadR");
let SC = document.getElementById("SColor");
Width.addEventListener("mousemove", function () {
target.style.width = Width.value + "px";
code();
});
Height.addEventListener("mousemove", function () {
target.style.height = Height.value + "px";
code();
});
Radius.addEventListener("mousemove", function () {
target.style.borderRadius = Radius.value + "px";
code();
});
Color.addEventListener("mousemove", function () {
target.style.backgroundColor = Color.value + "";
code();
});
OX.addEventListener("mousemove", function () {
let shadow = OX.value + "px " + OY.value + "px " + BR.value + "px " + SR.value + "px " + SC.value;
target.style.boxShadow = shadow;
code();
});
OY.addEventListener("mousemove", function(){
let shadow = OX.value + "px " + OY.value + "px " + BR.value + "px " + SR.value + "px " + SC.value;
target.style.boxShadow = shadow;
code();
});
BR.addEventListener("mousemove", function(){
let shadow = OX.value + "px " + OY.value + "px " + BR.value + "px " + SR.value + "px " + SC.value;
target.style.boxShadow = shadow;
code();
});
SR.addEventListener("mousemove", function(){
let shadow = OX.value + "px " + OY.value + "px " + BR.value + "px " + SR.value + "px " + SC.value;
target.style.boxShadow = shadow;
code();
});
SC.addEventListener("mousemove", function(){
let shadow = OX.value + "px " + OY.value + "px " + BR.value + "px " + SR.value + "px " + SC.value;
target.style.boxShadow = shadow;
code();
});
code();
function code() {
let editor = document.getElementById("box3");
let codes = "";
codes = `<span>width:</span> <span class="number">${Width.value}</span>px;<br>
<span>height:</span> <span class="number">${Height.value}</span>px;<br>
<span>border-radius:</span> <span class="number">${Radius.value}</span>px;<br>
<span>background-color:</span> <span class="number">${Color.value}</span>;<br>
<span>box-shadow: </span><span class="number">${OX.value}</span>px
<span class="number">${OY.value}</span>px <span class="number">${BR.value}</span>px
<span class="number">${SR.value}</span>px
<span class="number">${SC.value}</span>;`;
editor.innerHTML = codes;
}