0

I am developing a chrome extensions, so that this plugin used to send the selected text from a site to a server and return the text back to client. How can I make my plugin to float on the site, once the user select any text then my plugin must appear beside the selected text (Bubble), exactly like google translation plugin, which appears immediately when a user select some text.

I attached some picture to explain what I want exactly!

enter image description here

Community
  • 1
  • 1
Lylia John
  • 51
  • 8

1 Answers1

0

You can read out the current element where you select the text and from there you can put your icon with some distance.

Here you can find out how to get the current element:

How can I get the DOM element which contains the current selection?

With jQuery, you can easily put your icon next to the start of the selection. I have not tried id but this is how I would do that.

Community
  • 1
  • 1
Klassik
  • 141
  • 11