Skip to content

Instantly share code, notes, and snippets.

@lustremedia
Forked from ny0m/jplayer.draggable.js
Created May 19, 2014 12:33
Show Gist options
  • Save lustremedia/788b8fd639462bc31ca5 to your computer and use it in GitHub Desktop.
Save lustremedia/788b8fd639462bc31ca5 to your computer and use it in GitHub Desktop.
$('.jp-volume-bar').mousedown(function() {
var parentOffset = $(this).offset(),
width = $(this).width();
$(window).mousemove(function(e) {
var x = e.pageX - parentOffset.left,
volume = x/width
if (volume > 1) {
$("#JPID").jPlayer("volume", 1);
} else if (volume <= 0) {
$("#JPID").jPlayer("mute");
} else {
$("#JPID").jPlayer("volume", volume);
$("#JPID").jPlayer("unmute");
}
});
return false;
})
.mouseup(function() {
$(window).unbind("mousemove");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment