Created
July 26, 2012 03:11
-
-
Save MeoMix/3180025 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var updateSoundIcon = function(volume){ | |
//Repaint the amount of white filled in the bar showing the distance the grabber has been dragged. | |
var backgroundImage = '-webkit-gradient(linear,left top, right top, from(#ccc), color-stop('+ volume/100 +',#ccc), color-stop('+ volume/100+',rgba(0,0,0,0)), to(rgba(0,0,0,0)))'; | |
volumeSlider.css('background-image', backgroundImage); | |
var active = '#fff'; | |
var inactive = '#555'; | |
//Paint the various bars indicating the sound level. | |
var fillColor = volume >= 25 ? active : inactive; | |
$('#MuteButtonBar1').css('fill', fillColor); | |
fillColor = volume >= 50 ? active : inactive; | |
$('#MuteButtonBar2').css('fill', fillColor); | |
fillColor = volume >= 75 ? active : inactive; | |
$('#MuteButtonBar3').css('fill', fillColor); | |
//NOTE: Volume is a string here. Careful of type coercion. | |
fillColor = volume == 100 ? active : inactive; | |
$('#MuteButtonBar4').css('fill', fillColor); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment