PDA

View Full Version : Tooltip position on body scroll



webarts-pl
4 Sep 2010, 7:42 AM
Hi,
I have a Tooltip component. When I scroll document it doesn't move while scrolling and stays at the same position when was rendered. How to make it follow the target element?

Animal
4 Sep 2010, 8:03 AM
Scroll the document though? Why would you scroll a whole document?

webarts-pl
4 Sep 2010, 8:52 AM
I have a big form with many input elements. So the whole page is scrollable. When a tooltip is shown I can scroll whole document (eg. to see other values) and then the tooltip stays at the same position while all elements goes up/down the page while scrolling.

I am wondering if I should use Ext.getBody().on('scroll',function() { .. set new X,Y coordinats .. });

Animal
4 Sep 2010, 9:47 AM
Why is the whole page scrollable? Aren't you using a layout with just a FormPanel using autoScroll: true ?

Condor
6 Sep 2010, 1:56 AM
Are you sure the body is the scrolling element?

If it isn't then you need to render the tooltip the the element that does scroll (it renders to the body by default).

webarts-pl
6 Sep 2010, 12:55 PM
I'll try to make it more clear ;)

I have a panel (center) definied like this:

id: 'center',
region: 'center',
xtype: 'panel',
autoScroll : true,

Where I load (ajax) a content which is a qiute big form with a lot of form fields. So it is scrollable. In this page I attache dynamicaly target for each of them when a mouse click's on it:

function useQTip(el) <-- function used with html:onclick="..." for each element (after click tooltip shows)
{
/* config settings */
configQWindow.field = el;

/* anchor point */
qWin.initTarget('img_' + el);

/* show it */
qWin.show();
}

When Tooltip's shows during scrolling this content it maintains the same position. I would like to make it move Up/Down while scrolling.

Animal
6 Sep 2010, 9:37 PM
OK, so why did you say the document scrolls then?

Render the ToolTip to the Panel's body as Condor said.

laurentParis
6 Sep 2010, 9:46 PM
have you some css for your tooltip ?

webarts-pl
7 Sep 2010, 2:13 AM
OK, so why did you say the document scrolls then?
Render the ToolTip to the Panel's body as Condor said.

Thanks and sorry for my inaccuracy.

laurentParis (http://www.sencha.com/forum/member.php?173061-laurentParis):
Nope. I use default CSS for that Tooltip.

Animal
7 Sep 2010, 4:48 AM
You have the solution.