Skip to content

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