On 9/18/06, limodou <[EMAIL PROTECTED]> wrote:
> On 9/18/06, Stefan Petre <[EMAIL PROTECTED]> wrote:
> > limodou wrote:
> > > This code I copy from prototype, and made some changes, it doesnot
> > > calculate the width and height, only x and y, but it's quicker than
> > > jUtil.getPos(). BTW, I think interface plugins is wonderful, I begin
> > > use it to replace some functions written by me.
> > >
> > > $.fn.coordinate = function(){
> > >     e = this[0];
> > >     var y = 0, x = 0;
> > >     do {
> > >       y += e.offsetTop  || 0;
> > >       x += e.offsetLeft || 0;
> > >       e = e.offsetParent;
> > >       if (e) {
> > >         if(e.tagName=='BODY') break;
> > >         var p = $(e).position();
> > >         if (p == 'relative' || p == 'absolute') break;
> > >       }
> > >     } while (e);
> > >     return {x:x, y:y};
> > > }
> > >
> > > It seems that iUtil.getPos() does not test BODY node, and does not
> > > test position, so maybe these slow it down.
> > >
> > >
> > That function is deprecated. In  iUtil.js I have two functions
> > getPosition  - gest position in page and getSize - gets the elements size
> >
> Thanks I'll try them.
>
Very good, this time the speed is high. Thanks again.

-- 
I like python!
My Blog: http://www.donews.net/limodou
UliPad Site: http://wiki.woodpecker.org.cn/moin/UliPad
UliPad Maillist: http://groups.google.com/group/ulipad

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to