Guest User

Untitled

a guest
Apr 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. <p>
  2. <input class="slider" type="range" min="0" max="25" step="1" value="0" orient="vertical">
  3. </p>
  4.  
  5. .slider {
  6. -webkit-appearance: none;
  7. width: 400px;
  8. height: 8px;
  9. background: #d3d3d3;
  10. -webkit-transition: .2s;
  11. transition: opacity .2s;
  12. }
  13.  
  14. var cur = 0;
  15.  
  16. d3.select('input')
  17. .on("input", function() {
  18.  
  19. var threshold = d3.select(this).node().value;
  20. if (threshold > cur) {
  21. cur++
  22. } else if (threshold < cur) {
  23. cur--
  24. }
  25. d3.select(this).node().value = cur;
  26.  
  27. });
  28.  
  29. d3.select('input')
  30. .on("mousedown", function() {
  31. var node1 = this;
  32.  
  33. int = setInterval(function() {
  34. var threshold = d3.select(node1).node().value;
  35. if (threshold > cur) {
  36. cur++
  37. } else if (threshold < cur) {
  38. cur--
  39. }
  40. d3.select(node1).node().value = cur;
  41. }, 100)
  42.  
  43. }).on('mouseup', function() {
  44. clearInterval(int);
  45. });
Add Comment
Please, Sign In to add comment