-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
69 lines (68 loc) · 1.55 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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ripple effect demo</title>
<!-- include js -->
<script src="ripple.js"></script>
<!-- add animation -->
<style>
.ripple-container {
}
.ripple-container .ripple{
background-color: rgba(255,255,255,0.4);
animation: ripple 2s forwards cubic-bezier(0, 0, 0.2, 1);
}
@keyframes ripple {
0% {
transform: scale(0);
opacity: 1;
}
80% {
transform: scale(1);
}
100% {
opacity: 0;
}
}
</style>
<!-- demo page css -->
<style>
button {
background-color: dodgerblue;
color: white;
padding: 10px 20px;
border:0;
font-size: 14px;
cursor: pointer
}
</style>
</head>
<body>
<h1>Quick demo</h1>
<hr/>
<!-- we just added data-ripple attribute -->
<button data-ripple>
Demo button 1
</button>
<button data-ripple>
Demo button 2
</button>
<button data-ripple>
Demo button 3
</button>
<button data-ripple>
Demo button 4
</button>
<button data-ripple>
Demo button 5
</button>
<script>
// just add effect to elements
Array.prototype.forEach.call(document.querySelectorAll('[data-ripple]'), function(element){
// find all elements and attach effect
new RippleEffect(element); // element is instance of javascript element node
});
</script>
</body>
</html>