player.js: Fix marker sub-element hover xoffset
This commit is contained in:
parent
b920a1e5e9
commit
3749294def
|
@ -172,9 +172,17 @@ Player.prototype.onMarkerClick = function(marker, ev) {
|
|||
this.play();
|
||||
};
|
||||
|
||||
function getElementXOffsetFromPage(el) {
|
||||
var left = 0;
|
||||
do {
|
||||
left += el.offsetLeft;
|
||||
} while (el = el.offsetParent);
|
||||
return left;
|
||||
}
|
||||
|
||||
Player.prototype.onMarkerMouseMove = function(marker, ev) {
|
||||
if (this.currentMarker == marker) {
|
||||
marker.hoverx = (ev.offsetX - marker.el.offsetLeft) / marker.el.offsetWidth;
|
||||
marker.hoverx = (ev.pageX - getElementXOffsetFromPage(marker.el)) / marker.el.offsetWidth;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue