This is a migrated thread and some comments may be shown as answers.

Recenter tooltip from javascript.

3 Answers 88 Views
ToolTip
This is a migrated thread and some comments may be shown as answers.
NaturalCause
Top achievements
Rank 1
NaturalCause asked on 11 May 2010, 07:56 AM

When displaying the information is loaded from an ajax request, sometimes the information can be longer than usual, so i would like to re-position the tooltip.

How can i re-position the tooltip after its being displayed?

3 Answers, 1 is accepted

Sort by
0
Petio Petkov
Telerik team
answered on 12 May 2010, 02:59 PM
Hello Phillip Haydon,

By design RadToolTip will be automatically repositioned if it goes out of the visible area.
In case that you want to reposition the tooltip once it is opened you can use the following JavaScript code:
var popupBehavior = Telerik.Web.UI.RadToolTip.getCurrent().get_popupElement().PopupBehavior;
            popupBehavior.set_x(200);
            popupBehavior.set_y(200);

Let us know if you have any other questions.

Greetings,
Petio Petkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
NaturalCause
Top achievements
Rank 1
answered on 12 Jul 2010, 02:38 AM

Hey,

Didn't realise there was a reply to my question.

This doesn't exactly work as expected. If I open the tooltip as a modal, and the data changes after opening. expanding the height/width of the popup, just setting the x/y cords doesn't help position the modal in the correct place.

To recenter it I ended up using jQuery to get the Height/Width of the wrapper.

Set the top/left position to 50%.

Set the margin-top/margin-left to negative half the height/width of the wrapper.

This re-centers the popup correctly. This feature should be built in by default tho. I should be able to call tooltop.recenter(); and it does this for me.

0
Svetlina Anati
Telerik team
answered on 14 Jul 2010, 03:50 PM
Hi NaturalCause,

I tried to reproduce the problem you report but unfortunately to no avail - would you please share some relevant reproduction code which is fully runnable here? If we succeed to reproduce the problem and indeed we verify the validity of the scenario we will consider improving this behavior in the source code and we will also add some Telerik points for your kind cooperation.

Greetings,
Svetlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ToolTip
Asked by
NaturalCause
Top achievements
Rank 1
Answers by
Petio Petkov
Telerik team
NaturalCause
Top achievements
Rank 1
Svetlina Anati
Telerik team
Share this question
or