-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
69 lines (66 loc) · 1.74 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>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Range Slider</title>
<script src="./range-slider.js"></script>
<link rel="stylesheet" href="./range-slider.css"/>
</head>
<body>
<range-slider></range-slider>
<range-slider value="20-80" step="20"></range-slider>
<range-slider min=".1" max=".9" value="0.2-0.8" step=".01" style="
--thumb-width: 8px;
--thumb-height: 18px;
--thumb-mobile-width: 16px;
--thumb-border-radius: 0;
--thumb-bg: 0 0 0;
--track-height: 3px;
--track-bg: 241 219 15;
--value-bg: 0 0 0;
--value-color: 255 255 255;
--value-font-size: 12px;
"></range-slider>
<div id="value"></div>
<script>
const valueEl = document.getElementById('value');
document.addEventListener('range:input', function (event) {
valueEl.innerText = event.target.value.join(' — ');
});
</script>
<style type="text/css">
html, body {
height: 100%;
padding: 0;
margin: 0;
}
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 2rem;
font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 16px;
}
range-slider {
width: 220px;
}
#value {
box-sizing: border-box;
position: fixed;
width: 100px;
top: 20px;
left: calc(50% - 40px);
white-space: nowrap;
text-align: center;
border-radius: 5px;
}
#value:not(:empty) {
padding: 10px;
box-shadow: 0 2px 15px -3px rgb(0 0 0 / 0.15), 0 2px 6px -4px rgb(0 0 0 / 0.1);
}
</style>
</body>
</html>