Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix positioning bug in Chrome #196

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix positioning bug in Chrome #196

wants to merge 1 commit into from

Conversation

cchko
Copy link

@cchko cchko commented Oct 4, 2016

I've been using this library with D3, and noticed that the tooltips position themselves in the upper left corner of the screen when using Chrome.

this.$element.offset() was returning { top: 0, left: 0 }. I'm guessing this has to do with Webkit browsers and the way my D3 plots are rendered.

This branch replaces the call to $.extend({}, this.$element.offset(), {}) with this.$element[0].getBoundingClientRect(). This adds a few extra attributes to the pos object, but solves the issue and should work the same.

* offset() returns { top: 0, left: 0 } when used with d3.
* getBoundingClientRect() can replace offset() and the following lines.
@arne-diegenbach
Copy link

Excellent, just the fix needed. Thanks in 2018 :-).

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

Successfully merging this pull request may close these issues.

2 participants