1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-25 02:42:10 +02:00

Fixed volume to be more accurate.

This commit is contained in:
Steve Heffernan 2010-06-13 21:59:43 -07:00
parent 159a509962
commit d68a142abb
2 changed files with 5 additions and 4 deletions

View File

@ -54,8 +54,9 @@ img.vjs-poster { display: block; position: absolute; left: 0px; top: 0px; width:
/* Volume */ /* Volume */
.vjs-volume-control { width: 50px !important; cursor: pointer !important; } .vjs-volume-control { width: 50px !important; cursor: pointer !important; }
.vjs-volume-control ul { display: block; margin: 0; padding: 4px 0 0 5px; list-style: none; } .vjs-volume-control ul { display: block; margin: 0 5px 0 5px; padding: 4px 0 0 0; list-style: none; }
.vjs-volume-control ul li { float: left; margin: 0; padding: 0; list-style: none; width: 5px; margin-right: 2px; height: 0px; border-bottom: 18px solid #555; } .vjs-volume-control ul li { float: left; margin: 0 2px 0 0; padding: 0; list-style: none; width: 5px; height: 0px; border-bottom: 18px solid #555; }
.vjs-volume-control ul li:last-child { margin-right: 0; }
.vjs-volume-control ul li:nth-child(1) { border-bottom-width: 2px; height: 16px; } .vjs-volume-control ul li:nth-child(1) { border-bottom-width: 2px; height: 16px; }
.vjs-volume-control ul li:nth-child(2) { border-bottom-width: 4px; height: 14px; } .vjs-volume-control ul li:nth-child(2) { border-bottom-width: 4px; height: 14px; }
.vjs-volume-control ul li:nth-child(3) { border-bottom-width: 7px; height: 11px; } .vjs-volume-control ul li:nth-child(3) { border-bottom-width: 7px; height: 11px; }

View File

@ -537,14 +537,14 @@ var VideoJS = Class.extend({
}, },
setVolumeWithEvent: function(event){ setVolumeWithEvent: function(event){
var newVol = this.getRelativePosition(event.pageX, this.volumeControl); var newVol = this.getRelativePosition(event.pageX, this.volumeControl.children[0]);
this.setVolume(newVol); this.setVolume(newVol);
}, },
// Update the volume control display // Update the volume control display
// Unique to these default controls. Uses borders to create the look of bars. // Unique to these default controls. Uses borders to create the look of bars.
updateVolumeDisplay: function(){ updateVolumeDisplay: function(){
var volNum = Math.floor(this.video.volume * 6); var volNum = Math.ceil(this.video.volume * 6);
for(var i=0; i<6; i++) { for(var i=0; i<6; i++) {
if (i < volNum) { if (i < volNum) {
this.volumeDisplay.children[i].style.borderColor = "#fff"; this.volumeDisplay.children[i].style.borderColor = "#fff";