Made the place to insert the element configurable #47

Open
wants to merge 2 commits into
from

Projects

None yet

2 participants

@voxpelli
voxpelli commented May 2, 2011

Added two new options for defining where to the tipsy tooltip should be added in the dom tree.

One option, insertTo, defines which element it should be inserted in relation to and the other new option, insertMethod, defines how to add the tooltip.

Code has been added to adjust the position of the tooltip according to the position of the tooltip elements offsetParent - this makes sure that it's always positioned in the right place no matter where in the dom tree it is inserted.

An advantage of adding the tooltip deeper into the dom tree is that it may move together with that content if eg. the position of a common container was to be changed - which eg. happens on a centered site whenever the browser is resized.

This improvement is also important when attaching tooltips inside panels only visible on mouse over. Although IMHO a solution using a callback would be better, since it will allow for containers relative to the element triggering the tooltip. An implementation is #79.

Cheers

voxpelli added some commits May 2, 2011
@voxpelli voxpelli Made the place to insert the element configurable
Added two new options for defining where to the tipsy tooltip should be added in the dom tree.

One option, insertTo, defines which element it should be inserted in relation to and the other new option, insertMethod, defines how to add the tooltip.

Code has been added to adjust the position of the tooltip according to the position of the tooltip elements offsetParent - this makes sure that it's always positioned in the right place no matter where in the dom tree it is inserted.

An advantage of adding the tooltip deeper into the dom tree is that it may move together with that content if eg. the position of a common container was to be changed - which eg. happens on a centered site whenever the browser is resized.
a4be7b6
@voxpelli voxpelli Added possibility to define tipsy placement through a function.
As requested in jaz303#79
5e1ed67
voxpelli commented Dec 8, 2011

Updated to support the use case mentioned above and also updated to use jQuery's own offset() method to position the tooltip instead of calculating the position ourselves and then use jQuery's css() method to position it.

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