<h1>Em<span id="emoji-in-title"></span>ji Volume Slider</h1>
	<p>A pen by <a target="_blank" href="https://dnl.re/emoji-volume-slider/">Daniel Warkentin</a> based on <a target="_blank" href="https://codepen.io/emilcarlsson/pen/PPNLPy">Emil Carlsson's pen</a>.</p>
<p>Changes its volume knob to different emoticons based on the current volume.</p>
	<div id="player">
		<i class="fa fa-volume-down"></i>
		<div id="volume" class="v0"></div>
		<i class="fa fa-volume-up"></i>
	</div>
@import url(https://fonts.googleapis.com/css?family=Raleway:500);

$primary-color: #ea5732;

body {
	background: #2a2a2a;
	font-family: Raleway;
}
	
h1 {
	text-align: center;
	font-size: 34px;
	padding-top: 40px;
	color: #FFF;
	
	#emoji-in-title::after {
		content: '\1F60D';
		font-size: 0.7em;
	}
}
	
p {
	color: #999;
	text-align: center;
	font-size: 15px;
	
	a {
		color: $primary-color;
		text-decoration: none;
		padding: 1px 2px 0px 2px;
		border-bottom: 2px solid rgba(0, 0, 0, .0);
		transition: all .1s ease;
		
		&:hover {
			padding: 1px 2px 1px 2px;
			border-bottom: 2px solid #555;
		}
	}
}

#player {
	width: 350px;
	height: 50px;
	position: relative;
	margin: 0 auto;
	top: 80px;
	
	i {
		position: absolute;
		margin-top: -10px;
		color: #666;
		font-size: 25px;
	}
	
	i.fa-volume-down {
		margin-left: -20px;
	}
	
	i.fa-volume-up {
		margin-right: -20px;
		right: 0;
	}
}

#volume {
	position: absolute;
	left: 24px;
	margin: 0 auto;
	height: 5px;
	width: 300px;
	background: #555;
	border-radius: 15px;
	
	.ui-slider-range-min {
		height: 5px;
		width: 300px;
		position: absolute;
		background: $primary-color;
		border: none;
		border-radius: 10px;
  	outline: none;
	}
	
	.ui-slider-handle {
		width: 20px;
  	height: 20px;
		border-radius: 20px;
  	background: #FFF;
  	position: absolute;
  	margin-left: -8px;
  	margin-top: -8px;
  	cursor: pointer;
  	outline: none;
	}
}

#volume .ui-slider-handle {
    width: 0px;
    height: 0px;
			position: absolute;
			cursor: pointer;
			outline: none;
			border: none;
	}

#volume .ui-slider-handle::after {
	$size: 25px;
	font-size: $size;
	position: absolute;
	top: -5px;
	left: -$size/2
	
}

#volume {
	&.v0 .ui-slider-handle::after {
		content: '\1F634';
	}
	&.v1 .ui-slider-handle::after {
		content: '\1F62B';
	}
	&.v2 .ui-slider-handle::after {
		content: '\1F614';
	}
	&.v3 .ui-slider-handle::after {
		content: '\1F60C';
	}
	&.v4 .ui-slider-handle::after {
		content: '\1F60F';
	}
	&.v5 .ui-slider-handle::after {
		content: '\1F60A';
	}
	&.v6 .ui-slider-handle::after {
		content: '\1F604';
	}
	&.v7 .ui-slider-handle::after {
		content: '\1F60D';
	}
}

View Compiled
$("#volume").slider({
  	min: 0,
  	max: 100,
  	value: 0,
		range: "min",
  	slide: function(event, ui) {
    	changeSlider(ui.value);
  	}
	});
	
	var myMedia = document.createElement('audio');
	$('#player').append(myMedia);
	myMedia.id = "myMedia";

	playAudio('http://a.tumblr.com/tumblr_l14pkbmbuq1qavyj3o1.mp3', 0);
	
	function playAudio(fileName, myVolume) {
			myMedia.src = fileName;
			myMedia.setAttribute('loop', 'loop');
    	setVolume(myVolume);
    	myMedia.play();
	}
	
function setVolume(myVolume) {
	var myMedia = document.getElementById('myMedia');
	myMedia.volume = myVolume;
}

function changeSlider(myVolume) {
	let volumeThreshold = [15, 30, 45, 60, 70, 80, 96, 101]
	let volumeClasses = ["v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7"]
	let classIndex = volumeThreshold.findIndex((threshold) => {return myVolume < threshold});
	changeClassTo(volumeClasses[classIndex]);
	setVolume(myVolume / 100);
}

function changeClassTo(className) {
	$('#volume').removeClass();
	$('#volume').addClass(className);
}

Rerun