-
Notifications
You must be signed in to change notification settings - Fork 95
/
index.html
45 lines (38 loc) Β· 1.2 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
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<title>RefLine Demo</title>
<style>
.box {
width: 50px;
height: 50px;
position: absolute;
}
</style>
</head>
<body>
<div class="box" style="top:0; left:0;background: seagreen;"></div>
<div class="box" style="top:70px; left:0;background: chartreuse;"></div>
<div class="box" style="top:140px; left:0;background: saddlebrown;"></div>
<div class="box" style="width:80px;top:210px; left:0;background: salmon;"></div>
<div class="box" style="width:100px;top:280px; left:0;background: sandybrown;"></div>
<div class="box" style="width:120px;top:350px; height: 20px; left:0;background: skyblue;"></div>
<script src="./vendors/z-Dragify.js"></script>
<script src="./dist/ref-line.min.js"></script>
<script>
let boxes = Array.from(document.querySelectorAll('.box'))
let refLine = new RefLine()
boxes.forEach((item) => {
let drag = new Dragify(item)
drag
.on('move', () => {
refLine.check(drag.$elem, '.box')
})
.on('end', () => {
refLine.uncheck()
})
})
</script>
</body>
</html>