From d68a142abb9ec64d481741a184ced38009889436 Mon Sep 17 00:00:00 2001 From: Steve Heffernan Date: Sun, 13 Jun 2010 21:59:43 -0700 Subject: [PATCH] Fixed volume to be more accurate. --- video-js.css | 5 +++-- video.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/video-js.css b/video-js.css index f53ec349d..6d22abec7 100644 --- a/video-js.css +++ b/video-js.css @@ -54,8 +54,9 @@ img.vjs-poster { display: block; position: absolute; left: 0px; top: 0px; width: /* Volume */ .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 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 { display: block; margin: 0 5px 0 5px; padding: 4px 0 0 0; list-style: none; } +.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(2) { border-bottom-width: 4px; height: 14px; } .vjs-volume-control ul li:nth-child(3) { border-bottom-width: 7px; height: 11px; } diff --git a/video.js b/video.js index e24894aae..58c5f8a2b 100644 --- a/video.js +++ b/video.js @@ -537,14 +537,14 @@ var VideoJS = Class.extend({ }, setVolumeWithEvent: function(event){ - var newVol = this.getRelativePosition(event.pageX, this.volumeControl); + var newVol = this.getRelativePosition(event.pageX, this.volumeControl.children[0]); this.setVolume(newVol); }, // Update the volume control display // Unique to these default controls. Uses borders to create the look of bars. 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++) { if (i < volNum) { this.volumeDisplay.children[i].style.borderColor = "#fff";