-
Notifications
You must be signed in to change notification settings - Fork 82
/
index.html
81 lines (69 loc) · 2.92 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Multirange: A tiny polyfill for HTML5 multi-handle sliders.</title>
<link rel="stylesheet" href="index.css">
<link rel="stylesheet" href="multirange.css">
</head>
<body>
<header>
<h1>multirange</h1>
<p>A tiny polyfill for <a href="https://html.spec.whatwg.org/multipage/forms.html#range-state-(type=range):attr-input-multiple-3">HTML5 multi-handle sliders</a>.</p>
<pre><code><input type="range" <strong>multiple</strong> value="10,80" /></code></pre>
<a href="multirange.js" download>Download JS</a>
<a href="multirange.css" download>Download CSS</a>
</header>
<section class="demo">
<input type="range" multiple value="0,100" />
<input type="range" multiple value="10,80" />
<input type="range" multiple value="40,60" data-drag-middle />
<input type="range" multiple value="50,50" />
</section>
<section id="pros-cons">
<section class="pros">
<h1>Features</h1>
<ul>
<li>Only 0.6KB minified & gzipped!</li>
<li>No dependencies.</li>
<li>Uses feature detection, will not run if two-handle sliders are natively supported.</li>
<li>Keyboard accessible</li>
<li>Clicking on the track still works</li>
<li>Handles can be moved past each other</li>
<li>Customizable styling</li>
<li>JS properties polyfilled too (<code>input.value</code>, <code>input.valueLow</code>, <code>input.valueHigh</code>)</li>
</ul>
</section>
<section class="cons">
<h1>Limitations</h1>
<ul>
<li>Requires support for <code><input type="range"></code> (duh).</li>
<li>Fully works in <a href="http://caniuse.com/#search=css%20variables">browsers supporting CSS Variables</a> (Chrome, Firefox, Safari) as well as IE 10+. Fallback with 2 sliders in the rest.</li>
<li><code>input.value</code> not polyfilled in Safari (will be the same as <code>input.valueLow</code>).</li>
</ul>
</section>
</section>
<section>
<h1>Api</h1>
<ul>
<li>
<strong>JS:</strong> Use the <code>multirange(element)</code> function to process sliders added to the page later.
</li>
<li>
<strong>CSS:</strong> Use the <code>--range-color</code> property to change the color of the range.
Use the <code>--track-background</code> property for more extensive customization.
</li>
<li>
<strong>HTML:</strong> Use the <code>multiple</code> attribute to enable the second handle.
Use <code>data-drag-middle</code> attribute to enable moving both handles by dragging the middle of the track between them (as in the third example input).
</ul>
</section>
<footer>
Made with ♥ by <a href="http://lea.verou.me">Lea Verou</a>
• <a href="http://lea.verou.me/2016/05/introducing-multirange-a-tiny-polyfill-for-html5-two-handle-sliders" target="_blank">About</a>
<a href="https://github.com/LeaVerou/multirange" target="_blank" class="github-ribbon">Fork me on GitHub</a>
</footer>
<script src="multirange.js"></script>
</body>
</html>