Sunday, 18 August 2013

How to create tooltip over text selection without wrapping?

How to create tooltip over text selection without wrapping?

My end goal is to create a tooltip over a text selection. The user will
then be able to interact with the tooltip similar to . Please note that I
was able to accomplish this by wrapping selected text in a tag and then
creating the tooltip on it however this is no longer an option for me due
to some other requirements and functionality issues. If you notice in the
image above in element inspector, the selected text is not wrapped in any
kind of tag, the tooltip is just created over the selection. I have
already looked at this and it will not work for me because mouse position
may not be the same as the end of selection. I need the actual selection
position.
General question: What is the best way to accomplish this? More specific
questions:
Should I be using the coordinates of the selection? If so is there a way
to get the coordinates of the top corners of the rectangular selection so
I can find the mid point and create a the tooltip over that.
Is there a way to get that selection as an element? So I can just place a
tooltip over that? (Note the selection can be multiple nodes)

No comments:

Post a Comment