Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2006-01-02 21:26:11

batman900
New member
Registered: 2006-01-02
Posts: 3

Offset of the actual editor area

How can you determine the offset of the actual HTMLArea (i.e. offsetTop and offsetLeft, etc.)  I checked the _textarea, _htmlarea, and _iframe but all of them have a 0 offset.

Thank you for your help.

Offline

#2 2006-01-04 08:12:47

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: Offset of the actual editor area

offsetTop/Left is the offset from the parent element isn't it?  I think you should add up all the offsetTop's/Lefts back to the root element and that would give what you want.


James Sleeman

Offline

#3 2006-01-04 13:31:49

batman900
New member
Registered: 2006-01-02
Posts: 3

Re: Offset of the actual editor area

Thank you, the trick was to both accumulate the distance inside the _htmlArea but also take into account the height of the _toolbar.  The code snipped I ended up with was:
var xx = xinha_editors['MyTextFieldsId']._htmlArea;
var ol = 0, ot = 0;
while(typeof xx.tagName != 'undefined')
{
    ot += xx.offsetTop;
    ol += xx.offsetLeft;
    xx = xx.parentNode;
}
var htmlareaOffsettop = ot + xinha_editors['HTMLEditor']._toolbar.offsetHeight;
var htmlareaOffsetleft = ol + el.offsetLeft;

Offline

Board footer

Powered by FluxBB