Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <p>
- <input class="slider" type="range" min="0" max="25" step="1" value="0" orient="vertical">
- </p>
- .slider {
- -webkit-appearance: none;
- width: 400px;
- height: 8px;
- background: #d3d3d3;
- -webkit-transition: .2s;
- transition: opacity .2s;
- }
- var cur = 0;
- d3.select('input')
- .on("input", function() {
- var threshold = d3.select(this).node().value;
- if (threshold > cur) {
- cur++
- } else if (threshold < cur) {
- cur--
- }
- d3.select(this).node().value = cur;
- });
- d3.select('input')
- .on("mousedown", function() {
- var node1 = this;
- int = setInterval(function() {
- var threshold = d3.select(node1).node().value;
- if (threshold > cur) {
- cur++
- } else if (threshold < cur) {
- cur--
- }
- d3.select(node1).node().value = cur;
- }, 100)
- }).on('mouseup', function() {
- clearInterval(int);
- });
Add Comment
Please, Sign In to add comment