On 10/3/06, Dave Benjamin <[EMAIL PROTECTED]> wrote:
> I'm not too crazy about .top() and .left() because of the need to
> concatenate and un-concatenate 'px' everywhere.

I can understand this and it is something I'm trying to decide how I
want to handle. The offset plugin I wrote returns a unit-less number
and it should be that way but I was thinking about including a
property: toppx and leftpx that would include + 'px'. Not sure how
useful that really is though ... and while I talking about this plugin
...

I was thinking about allowing it to take another element or expression
as a parm and get the relative offset instead of going all the way to
the body. Does anyone think this would be useful? It shouldn't add
much overhead to the method for those that don't need it.

I was also thinking about taking a hash of top and left as a param.
The top and left would be numbers to relatively offset the element by.
This sounds like what you are talking about and would remove the
annoyance of the + 'px' all over the place. However, the call would
look like this: $().offset({ top: 10, left: 10 }); I guess that is
less typing than: $().top(10+'px').left(10+'px');

One issue I have with this is what should it actually return? I don't
think it is a good idea to change return types but it would make most
sense in this situation to return the jQuery object. The other issue
is that calling offset like this would suggest that it acts on all the
elements in the jQuery object whereas just $().offset() acts only on
the first. So .... yeah I've thinking hard about it and could use some
opinions.

> Wow. I saw your post about this earlier but I must not have been paying
> enough attention. Very nice, Brandon!

Thank you!

--
Brandon Aaron

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to