enyo / opentip

Opentip is an open source javascript tooltip based on the protoype framework.
http://www.opentip.org
1.25k stars 401 forks source link

Tooltips sometimes being placed at 0, 0 instead of actual element #39

Closed abyx closed 11 years ago

abyx commented 11 years ago

Me again :) So my code just loops over the rows in my view and create tooltips for each. With each refresh I get a different few rows whose tooltips get displayed at [0, 0] (actually [12, 12], but might have something to do with the fact I have offset = [5, 5]).

It's a different row each time, making it seem random. I'm printing to the console whenever I create the tooltip, to make sure that the element is indeed already in the DOM before creating the tooltip, and they all are. What am I doing wrong?

abyx commented 11 years ago

Debugging this some more, I see that the problem is that the native adapter's mousePosition returns 0, 0, because reposition is called with an event that isn't a mouse event, but a scroll event. This happens when I scroll over elements that have tooltips. I'm guessing the code needs to be changed to just keep track of the latest mouse position or something like that?

enyo commented 11 years ago

Great news. Thanks for finding the source of the problem. Would you mind testing it with jQuery, and see if it works, so I know the problem is only related to the native adapter? (Maybe that fixes the other issue as well).

Sorry that Opentip is causing you so much trouble... I think the native adapter needs some love in some areas.

abyx commented 11 years ago

Hmmm. I've just checked with jQuery 1.9.1 and 1.7.1 and in both it always shows up at 0, 0 (i.e. never works). It seems like mousePosition is being called with no event?

enyo commented 11 years ago

Thanks for testing with jQuery. I'll try to find the problem.

enyo commented 11 years ago

I'm in the progress of fixing this problem. Hopefully it'll be done tomorrow.

abyx commented 11 years ago

Thanks a lot! FWIW, I was able to workaround this, but #42 isn't as easy to workaround