Skip to content

Commit

Permalink
use width not outerWidth for zepto compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoff Hankerson committed Sep 6, 2018
1 parent 54b9c22 commit bd17dea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ An HTML 5 audio player supporitng live streams and archived playback.
Supports variable DOM elements and has features like playlist support
and scrubbable progress bar.

Requirements
2.x Requirements
- jQuery

3.x Requirements none
In version 3.0 we removed jquery ias a dependency to allow passing in an alternate library like zepto.
This means you have to pass jQuery or Zepto into the constructor.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"url": "[email protected]:js-libraries/apm-html5-player.git"
},
"title": "APM HTML5 Player",
"version": "0.3.0"
"version": "0.3.1"
}
4 changes: 2 additions & 2 deletions script/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@

Player.prototype.getSecondsByClickPosition = function($element, clickXPosition) {
var timelineOffset = $element.offset().left;
var timelineWidth = $element.outerWidth();
var timelineWidth = $element.width();
var positionInElement = clickXPosition - timelineOffset;
var percent = positionInElement / timelineWidth;
var time = this.audio.duration * percent;
Expand All @@ -348,7 +348,7 @@

Player.prototype.getVolumeByHorizClickPosition = function($element, clickXPosition) {
var volumeBarOffset = $element.offset().left;
var volumeBarWidth = $element.outerWidth();
var volumeBarWidth = $element.width();
var positionInElement = clickXPosition - volumeBarOffset;
var percent = positionInElement / volumeBarWidth;
var volume = Number(percent.toFixed(2));
Expand Down

0 comments on commit bd17dea

Please sign in to comment.