[jQuery] Dimensions .offset() method *UPDATE*

[jQuery] Dimensions .offset() method *UPDATE*

Okay so I've gotten some good feedback on the new offset method and
have made some additional changes to make the method a little more
flexible to people's needs.
The offset method signature has changed and now takes an options hash
as the first param and a return object as the second param.
The options hash has 4 properties that each take a boolean.
margin:
Should the margin of the element be included in the calculations? True
by default. If set to false the margin of the element is subtracted
from the total offset.
border:
Should the border of the element be included in the calculations? True
by default. If set to false the border of the element is subtracted
from the total offset.
padding:
Should the padding of the element be included in the calculations?
False by default. If set to true the padding of the element is added
to the total offset.
scroll:
Should the scroll offsets of the parent elements be included in the
calculations? True by default. When true, it adds the total scroll
offsets of all parents to the total offset and also adds two
properties to the returned object, scrollTop and scrollLeft. If set to
false the scroll offsets of parent elements are ignored. If scroll
offsets are not needed, set to false to get a performance boost.
You can see these properties in action on the updated test/demo page:
http://brandon.jquery.com/plugins/dimensions/test/offset.html
The second param is just an object to use for the return value. If
passed in, then the chain will not be broken. Here is an example:
var offset = {};
$('#testdiv').do().something().offset({scroll: false},
offset).do().some().more();
Then if you looked at the offset object it would would have top and
left properties.
The new test/demo page now gives you the opportunity to try different
options and see how they work. I've also added a div with overflow:
auto to see what the scroll option does.
Test/Demo: http://brandon.jquery.com/plugins/dimensions/test/offset.html
Source from SVN:
http://jquery.com/dev/svn/trunk/plugins/dimensions/dimensions.js?format=txt
--
Brandon Aaron
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/