Skip to content
This repository has been archived by the owner on Dec 17, 2018. It is now read-only.

mouseTime fix #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion videojs.thumbnails.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@
// `left` applies to the mouse position relative to the player so we need
// to remove the progress control's left offset to know the mouse position
// relative to the progress control
mouseTime = Math.floor((left - progressControl.el().offsetLeft) / progressControl.width() * duration);
var el = progressControl.el();
var boxX = el.getBoundingClientRect().left + (window.pageXOffset || document.body.scrollLeft) - (document.documentElement.clientLeft || document.body.clientLeft || 0);
mouseTime = Math.floor(Math.max(0, Math.min(1, (pageX - boxX) / el.offsetWidth)) * duration);

for (time in settings) {
if (mouseTime > time) {
active = Math.max(active, time);
Expand Down