atomiks / tippyjs

Tooltip, popover, dropdown, and menu library
https://atomiks.github.io/tippyjs/
MIT License
11.86k stars 520 forks source link

`.show()` to allow for `x,y` coordinate overrides for alternative placement #1076

Open GresiRoost opened 1 year ago

GresiRoost commented 1 year ago

Problem

Sometimes I want a tippy tooltip to appear at my target object as if the mouse was at a given location. Tippy doesn't currently seem to support this even though it seems simple to add as optional parameters.

Solution

Add optional x,y coordinates to the .show() method such that tippy uses those instead of the mouse coordinates. The tooltip would then appear based on the various placement rules as usual. Perhaps a 'relativeTo' parameter could be useful so you can either give "local" coordinates (within the target object's coordinate system where 0,0 is the top-left corner) or "global" (the document coordinate system).