Skip to content

Allow call repositioning for a tooltip #27

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

Merged
merged 1 commit into from
Aug 29, 2012
Merged

Allow call repositioning for a tooltip #27

merged 1 commit into from
Aug 29, 2012

Conversation

ixti
Copy link
Contributor

@ixti ixti commented Aug 29, 2012

This patch allows call a repositioning of a tooltip:

$.powerTip.resetPosition($('#myTip'));

This patch allows call arepositioning of a tooltip:

    $.poerTip.resetPosition($('#myTip'));
@stevenbenner
Copy link
Owner

Accepted. This could be helpful for elements that change size or position. Thank you!

stevenbenner added a commit that referenced this pull request Aug 29, 2012
Allow call repositioning for a tooltip
@stevenbenner stevenbenner merged commit 9b8b48c into stevenbenner:master Aug 29, 2012
@puzrin
Copy link

puzrin commented Aug 31, 2012

@stevenbenner we did this patch, because tooltip is always pinned with (left,top) corner. So, it's always extends (down,right). Why don't you use another corners, depending on gravity? Did you have any issues with that?

@stevenbenner
Copy link
Owner

There really isn't any actual rational for it. Using top and left CSS placement is simply the how I did it when I built the first prototype and it stuck around. I recently had to switch to using top and right for the w, nw, and sw placements to support elastic tooltips so that they could expand properly.

I can't think of any reason to keep it this way, but I also cannot think of any reason to change it. Did you experience some problems because of the way CSS positioning is done now?

@puzrin
Copy link

puzrin commented Aug 31, 2012

Yes, we had the real case (and did this commit as workaround). Look at the sample

example

We load content in 2 stages:

  • show dummy popup with "loading" progress
  • substitute content

If popup grows on second step, then it overlap link (now). So, now we have to call recacculation, to move it up. But if you pin popup with bottom left corner, then it will automatically extend in proper direction (up and right).

IMHO, in practice, it would be very convenient to select "proper" pinned corner for each gravity option. Then it will change inproper direction without additional JS call.

The second issue is "offset" option. You could set it to 0 by default, and use "margin" for proper popup offset - that can be better separation between code and representation.

If you need my help about CSS - let me know

@stevenbenner
Copy link
Owner

Oh, of course! If the content inside of the tooltip changes the size of the tooltip then it will move the arrow. Okay, yes, tooltips should use appropriate CSS placement based on the corner that has the pointer.

But one question remains: How can I handle content resizing for tooltips where the arrow is centered on a side instead of fixed to a corner (n, e, s, w)?

I had thought about using margin instead of offset, and it does work well. That might be worth changing too.

@puzrin
Copy link

puzrin commented Aug 31, 2012

For side-placed tooltip there are no unique pinning solution. But it's limited to 2 possible choices, instead of 4. I don't have strong opinion, how to choose the best corner of 2.

IMHO, rigth now you can select any of 2, and if someone will have the real case in practice, then you could improve it. IMHO, if someone have top or bottom placed popup, he will fix width. Then content change will only affect height - no problem.

For left/right side popovers - probably growing down is more "logical". Anyway, you can call JS recalculation, if you have really special case.

@stevenbenner
Copy link
Owner

Agreed, this will get added to the to-do list. Can you repost your last two comments with the nice screenshot in a new issue so I don't forget about our conversation in this closed pull request.

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

Successfully merging this pull request may close these issues.

3 participants