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
_______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/