Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<html>
<head>
  <script src="https://code.jquery.com/jquery-3.1.0.js"></script><!DOCTYPE html>
</head>
<body>
  <div class="vol-icon vol-0"></div>
  <input type="range" class="slider" min="0" max="100" value="0" oninput="change_volume(this.value)"/>
</body>
</html>
 
body {
  background-color: #a04;
}
.vol-icon {
  width: 32px;
  height: 32px;
  background-repeat: no-repeat;
}
.vol-0 { background-image: url(https://i.imgur.com/wZgLWGA.png) }
.vol-1 { background-image: url(https://i.imgur.com/oSv6akO.png) }
.vol-2 { background-image: url(https://i.imgur.com/rAoLkaw.png) }
.vol-3 { background-image: url(https://i.imgur.com/4I0XTWQ.png) }
 
var change_volume = function(val) {
  var cls = 'vol-' + (val == 0 ? 0 : val < 33 ? 1 : val < 66 ? 2 : 3);
  var icon = $('.vol-icon');
  if (icon.hasClass(cls)) { return; }
  icon.removeClass('vol-0 vol-1 vol-2 vol-3').addClass(cls);
};
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers