-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
94 lines (83 loc) · 2.16 KB
/
index.html
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>颜色选择器</title>
<style>
html {
background: linear-gradient(90deg, #fafafa 0%, #00f50c52 54%, #00f50ccf 100%);
}
.container {
display: grid;
grid-template-columns: auto auto;
width: 100%;
height: 80vh;
grid-gap: 20px;
}
.title {
font-weight: bold;
margin-left: 45%;
font-size: 2rem;
margin-bottom: 50px;
}
</style>
</head>
<body>
<div class="title">选择颜色</div>
<div class="container">
<div>
<div id="color-picker1"></div>
</div>
<div>
<div id="color-picker2"></div>
</div>
<div>
<div id="color-picker3"></div>
</div>
<div>
<div id="color-picker4"></div>
</div>
</div>
</body>
<script type="module">
import XLColorPicker from './xl-color-picker-m.js'
let bg = document.querySelectorAll('.container > div');
let a = new XLColorPicker({
id: 'color-picker1',
eleColor: "#3367d1",
canMove: true,
getCurrentColor: function (color) {
bg[0].style.background = color;
console.log(color);
},
})
let b = new XLColorPicker({
id: 'color-picker2',
eleColor: "#010101",
canMove: true,
getCurrentColor: function (color) {
bg[1].style.background = color;
console.log(color);
},
})
let c = new XLColorPicker({
id: 'color-picker3',
eleColor: "#7b99fd",
canMove: true,
getCurrentColor: function (color) {
bg[2].style.background = color;
console.log(color);
},
})
let d = new XLColorPicker({
id: 'color-picker4',
eleColor: "#f3f5fa",
canMove: false,
getCurrentColor: function (color) {
bg[3].style.background = color;
console.log(color);
},
})
</script>
</html>