Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

Fix mouse offset when parent has position:relative #4166

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

AndrolGenhald
Copy link

Fix issue when parent has position: relative. offsetLeft is offset from the nearest relatively positioned parent, so a relative parent that has any sort of left offset will cause the mouse position to be wrong. This issue isn't noticeable in most cases because it's taking the difference between the time you start dragging at and the current time under the mouse, and most timelines are linear. It does cause issues with non-linear timelines though, such as when some periods are hidden.

JSFiddle

Examples

Old code with left margin
broken-margin
Fixed code with left margin
fixed-margin
Old code with scroll
broken-scroll
Fixed code with scroll
fixed-scroll

@yotamberk
Copy link
Contributor

The timeline is no longer maintained here. Please resubmit this PR to the new maintained repo:
https://github.com/yotamberk/timeline-plus

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants