Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to center tooltip? #10

Open
hackuun opened this issue Aug 17, 2017 · 1 comment
Open

How to center tooltip? #10

hackuun opened this issue Aug 17, 2017 · 1 comment

Comments

@hackuun
Copy link

hackuun commented Aug 17, 2017

Is there any option by any chance to center tooltip?
If you look closely to Medium, they have it.

@MaxArt2501
Copy link
Owner

I guess you mean you want the tooltip centered in relation to the selected area, not close to the final end of the selection.

No, at this moment there's no such option. It might be worth considering, although you can set the position of the popover as you want by defining a callback for the onOpen hook. For example:

shareThis({
  onOpen(popover) {
    popover.style.right = "";
    popover.style.maxWidth = "none";
    const range = getSelection().getRangeAt(0);
    const rect = range.getBoundingClientRect();
    for (const prop of [ "top", "left", "width", "height" ]) {
      popover.style[prop] = rect[prop] + "px";
    }
  }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants