javascript - Firefox: Get mouse coordinates of top-left corner of viewport -
Good day all.
I am working on a Firefox extension, and I have a tooltip on a fixed offset with a mouse cursor, however, the problem occurs when the offset goes out of the viewport, but it is displayed to the user There you have to scroll over. I hope to increase this by moving tooltip pop-ups to the current viewport.
However, a problem arises because I have only a clue where I am in the document, the mouse-position is to calculate the partial solution that the tooltip's width / height and coordinate of the current window + tooltip width / Height indicates how much it takes the tool tip, to see if it is more than window. WinnerHight or Window Winner
However, I realized that if this was a long document and the user used to scroll down a fair bit, then the mouse coordinate would have a very large Wi value. So, I can not completely trust the window. The winner to see if I am now in the viewport, has a person found a way to locate the mouse coordinate of the upper left corner in the viewport, if the user has scrolled down a lot?
Thanks in advance! =)
More specifically in your case, document.body.scrollTop
.
However, it is very IE-specific, which drapes the purpose of most Firefox extensions ;-) There are some DTD dependencies to boot.
Looks like what you want:
Comments
Post a Comment