share-this
share-this copied to clipboard
How to center tooltip?
Is there any option by any chance to center tooltip? If you look closely to Medium, they have it.
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";
}
}
});