-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
73 lines (67 loc) · 1.9 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div class="test test-1" style="width: 100px; height: 100px; background-color: lightblue;"></div>
<div class="test test-2" style="width: 100px; height: 100px; background-color: lightcoral;"></div>
<div class="test test-3" style="width: 100px; height: 100px; background-color: lightgreen;"></div>
<button class="test-button" style="padding: 12px;">ABC</button>
<button class="destory" style="padding: 12px;">销毁</button>
<br />
<style>
.test-button-2 {
position: relative;
}
.ripple-wrapper {
inset: 0px;
position: absolute;
pointer-events: none;
}
</style>
<button class="test-button-2" style="padding: 12px;">
<span>ABC</span>
<div class="ripple-wrapper"></div>
</button>
<script type="module">
import { Ripple } from './dist/index.esm.js';
new Ripple(
{
element: document.querySelector('.test.test-1'),
},
);
new Ripple(
{
color: 'rgb(167 25 25 / 72%)',
element: document.querySelector('.test.test-2'),
centered: true,
},
);
new Ripple(
{
color: 'rgb(43 115 43 / 75%)',
element: document.querySelector('.test.test-3'),
unbounded: true,
},
);
const ripple = new Ripple(
{
element: document.querySelector('.test-button'),
exitDuration: 1000,
enterDuration: 5000
},
);
document.querySelector('.destory').addEventListener('click', () => ripple.destroy());
new Ripple(
{
element: document.querySelector('.test-button-2'),
rippleWrapper: document.querySelector('.test-button-2 .ripple-wrapper'),
},
);
</script>
</body>
</html>