I want to show a tooltip under the mousecursor. Since JQueryMobile doesn't have any widget for this, I use the Popup widget (which comes very close).
When showing the popup, I can specify X and Y coordinates. But the problem is it centers the popup based on X and Y. And I want to display it on the right-side of the mousecursor, not right under it (because that makes the text hard to read because the cursor is over it).
How can I show a popup this way? The only thing I can think of is measuring the width of the popup element, and correct the coordinates based on the width/height of the popup. But this seems impossible, because I can only measure the actual width after the popup is rendered to the screen, and I need to specify X/Y before the popup is showed. Seems like a catch 22 situation?
As discussed in the comments under the question, a native/vanilla Javascript tooltip, that is fully customizable. And intuitive, even if I say so myself. Here is the live demo: http://jsbin.com/nerul/3/edit?html,output.
And this is the code:
.
With your reputation, matters should be fully self-explanatory. If not, just let me know.