-
Notifications
You must be signed in to change notification settings - Fork 138
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
Conversation
This patch allows call arepositioning of a tooltip: $.poerTip.resetPosition($('#myTip'));
Accepted. This could be helpful for elements that change size or position. Thank you! |
Allow call repositioning for a tooltip
@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? |
There really isn't any actual rational for it. Using 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? |
Yes, we had the real case (and did this commit as workaround). Look at the sample We load content in 2 stages:
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 |
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. |
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. |
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. |
This patch allows call a repositioning of a tooltip: