cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <h1>Mousewheel controlled volume knob input</h1>

<div class="knob-surround">
  
  <div class="knob"></div>
  
  <span class="min">Min</span>
  <span class="max">Max</span>
  
  <div class="ticks">
    <div class="tick activetick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
    <div class="tick"></div>
  </div>
  
</div>

<p>Hover over the volume knob and use mousewheel to change value. It would be relatively easy to add drag/touch gesture support also.</p>
<p>Current value: <span class="current-value">0%</span></p>
<p>By <a href="https://twitter.com/blucube">Ed Hicks</a> - Inspired by a <a href="http://dribbble.com/shots/753124-Volume-Knob">dribbble shot</a> by <a href="https://twitter.com/rickss">Ricardo Salazar</a></p>

            
          
!
            
              // fonts
@import url(https://fonts.googleapis.com/css?family=Varela+Round|Open+Sans:300);

// colours
@knob-colour: #181818;
@light-colour: #a8d8f8;

// mixins (mainly LESS Elements)
.gradient(@color: #F5F5F5, @start: #EEE, @stop: #FFF) {
  background: @color;
  background: -webkit-gradient(linear, left bottom, left top, color-stop(0, @start), color-stop(1, @stop));
  background: -ms-linear-gradient(bottom, @start, @stop);
  background: -moz-linear-gradient(center bottom, @start 0%, @stop 100%);
  background: -o-linear-gradient(@stop, @start);
  filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@stop,@start));
}

.box-shadow(@arguments) {
  -webkit-box-shadow: @arguments;
  -moz-box-shadow: @arguments;
  box-shadow: @arguments;
}

.transform(@arguments) {
  -webkit-transform: @arguments;
  -moz-transform: @arguments;
  -o-transform: @arguments;
  -ms-transform: @arguments;
  transform: @arguments;
}

.transition(@arguments) {
  -webkit-transition: @arguments;
  -moz-transition: @arguments;
  -o-transition: @arguments;
  transition: @arguments;
}

// main styles
body {
  background-color: @knob-colour;
  font-size: 100%;
  font-family: "Open Sans", sans-serif;
  color: #aaa;
  text-align: center;
}

.knob-surround {
  position: relative;
  background-color: grey;
  width: 14em;
  height: 14em;
  border-radius: 50%;
  border: solid .25em darken(@knob-colour, 4%);
  margin: 5em auto; 
  .gradient(@knob-colour, lighten(@knob-colour, 2%), darken(@knob-colour, 2%));
  .box-shadow(
    0 .2em .1em .05em rgba(255,255,255,.1) inset,
    0 -.2em .1em .05em rgba(0,0,0,.5) inset,
    0 .5em .65em 0 rgba(0,0,0,.3);
  );
}

.knob {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  .transform(rotate(0deg));
  z-index: 10;
}

.knob:before {
  content: "";
  position: absolute;
  bottom: 19%;
  left: 19%;
  width: 3%;
  height: 3%;
  background-color: @light-colour;
  border-radius: 50%;
  .box-shadow(0 0 .4em 0 darken(@light-colour, 10%));
}

.min,
.max {
  display: block;
  font-family: "Varela Round", sans-serif;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
  font-size: 70%;
  position: absolute;
  opacity: .5;
}

.min {
  bottom: 1em;
  left: -2.5em;
}

.max {
  bottom: 1em;
  right: -2.5em;
}
  
.tick {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 5;
  overflow: visible;
}

.tick:after {
  content: "";
  width: .08em;
  height: .6em;
  background-color: rgba(255,255,255,.2);
  position: absolute;
  top: -1.5em;
  left: 50%;
  .transition(all 180ms ease-out);
}

.activetick:after {
  background-color: @light-colour;
  .box-shadow(0 0 .3em .08em darken(@light-colour, 10%));
  .transition(all 50ms ease-in);
}

// yeah, I know, use SASS  :)
.tick:nth-child(1)  { .transform(rotate(-135deg)); }
.tick:nth-child(2)  { .transform(rotate(-125deg)); }
.tick:nth-child(3)  { .transform(rotate(-115deg)); }
.tick:nth-child(4)  { .transform(rotate(-105deg)); }
.tick:nth-child(5)  { .transform(rotate(-95deg));  }
.tick:nth-child(6)  { .transform(rotate(-85deg));  }
.tick:nth-child(7)  { .transform(rotate(-75deg));  }
.tick:nth-child(8)  { .transform(rotate(-65deg));  }
.tick:nth-child(9)  { .transform(rotate(-55deg));  }
.tick:nth-child(10) { .transform(rotate(-45deg));  }
.tick:nth-child(11) { .transform(rotate(-35deg));  }
.tick:nth-child(12) { .transform(rotate(-25deg));  }
.tick:nth-child(13) { .transform(rotate(-15deg));  }
.tick:nth-child(14) { .transform(rotate(-5deg));   }
.tick:nth-child(15) { .transform(rotate(5deg));    }
.tick:nth-child(16) { .transform(rotate(15deg));   }
.tick:nth-child(17) { .transform(rotate(25deg));   }
.tick:nth-child(18) { .transform(rotate(35deg));   }
.tick:nth-child(19) { .transform(rotate(45deg));   }
.tick:nth-child(20) { .transform(rotate(55deg));   }
.tick:nth-child(21) { .transform(rotate(65deg));   }
.tick:nth-child(22) { .transform(rotate(75deg));   }
.tick:nth-child(19) { .transform(rotate(45deg));   }
.tick:nth-child(20) { .transform(rotate(55deg));   }
.tick:nth-child(21) { .transform(rotate(65deg));   }
.tick:nth-child(22) { .transform(rotate(75deg));   }
.tick:nth-child(23) { .transform(rotate(85deg));   }
.tick:nth-child(24) { .transform(rotate(95deg));   }
.tick:nth-child(25) { .transform(rotate(105deg));  }
.tick:nth-child(26) { .transform(rotate(115deg));  }
.tick:nth-child(27) { .transform(rotate(125deg));  }
.tick:nth-child(28) { .transform(rotate(135deg));  }

h1 {
  font-weight: normal;
  margin: 2em 0;
}

p {
  line-height: 150%;
  max-width: 36em;
  margin: 1em auto;
}

a {
  color: #aaa;
  text-decoration: none;
  border-bottom: 1px solid #444;
  .transition(color .2s ease-in);
}

a:hover,
a:focus {
  color: #eee;
}

// background image noise
body,
.knob {
  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAgAElEQVR4nMVdeUAWVdf/NY7j4zAim2ia+YqiuGJuFCm4gyFqromiaInkS7igoFgKpamoiKiFCwgEKIpauaKgCC5gLpniirmQS+4LbtCr3x80l9lnHqC+31/wzMy955x77nbuOeeiX79+1L179xio4P3336fVnvGoWbMmvWfPHg4AMjMzWaV3Fi1aRG3cuFG1HqOwtbVlN27caAkADx8+pPPy8uyk7zx69EhWz44dO8h7qampTN++fQmdPF3R0dF0bGwsV1kaeURHR3NOTk4m/v+BAwdq8j9w4EAOt2/fJi95e3vrCp+Hs7OzouArg6KiIkr6W3h4uL3edzY2Nibh/0ePHjWpvcsjICDA1LBhQ00eHj58SJ7/+OOPRE5ubm6q31lYWHCXL1+uskaVgWVZZv/+/dSBAwcMN9bKlSvNaqyoqCjVsp8/f/7PMfc3GjRooKm5oaGhouebNm3ipk6dSgOAk5MTof3UqVMiPsLDw9nc3Fyuc+fOujx06tRJpowiODs7MwMGDBANB6WlpSZXV1f6zz//VKzA0dFRVzNLS0urvGcFBwdzHTp0UGTI3t5e1tjFxcWKNNSvX19bKBrgOI7bvn07BQBLliwxrETNmze3AoAvvvjCV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8Wj8AOHXqlKHe8eDBAw4oiyc5fvy4LsEff/yxMNJVtesmJiZyDx48qNAwVpnway3wi5kbN24wBQUFNkB5ggUt9O7dm2ndujUjuxdReG13dHS0rKCjR48yfCz28OHDGaD8gnclt6DmzZvLynj27Bl94cKFKgsxe++994i2ZmZmajaQWgOqXYaWl5dH169fnwOAqVOnkndOnz5NeOXzfgmhdy2e0h1YALB48WKGz6/yf8RxFhxL0FjRAAAAAElFTkSuQmCC);
}
            
          
!
            
              var knob = $('.knob');
var angle = 0;
var minangle = 0;
var maxangle = 270;

function moveKnob(direction) {
  
  if(direction == 'up') {
    if((angle + 2) <= maxangle) {
      angle = angle + 2;
      setAngle();
    }
  }
  
  else if(direction == 'down') {
    if((angle - 2) >= minangle) {
      angle = angle - 2;
      setAngle();
    }
  }

}

function setAngle() {

  // rotate knob
  knob.css({
    '-moz-transform':'rotate('+angle+'deg)',
    '-webkit-transform':'rotate('+angle+'deg)',
    '-o-transform':'rotate('+angle+'deg)',
    '-ms-transform':'rotate('+angle+'deg)',
    'transform':'rotate('+angle+'deg)'
  });
  
  // highlight ticks
  var activeTicks = (Math.round(angle / 10) + 1);
  $('.tick').removeClass('activetick');
  $('.tick').slice(0,activeTicks).addClass('activetick');
  
  // update % value in text
  var pc = Math.round((angle/270)*100);
  $('.current-value').text(pc+'%');
  
}

// mousewheel event - firefox
knob.bind('DOMMouseScroll', function(e){
  if(e.originalEvent.detail > 0) {
    moveKnob('down');
  } else {
    moveKnob('up');
  }
  return false;
});

// mousewheel event - ie, safari, opera
knob.bind('mousewheel', function(e){
  if(e.originalEvent.wheelDelta < 0) {
    moveKnob('down');
  } else {
    moveKnob('up');
  }
  return false;
});

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console