doc: Merged/updated old docs for Element.cumulativeScrollOffset, clarified units, added example.

This commit is contained in:
tjcrowder 2009-10-09 17:10:13 +01:00
parent f1f6fca60b
commit adf80ad1b3
1 changed files with 16 additions and 2 deletions

View File

@ -1232,11 +1232,25 @@ Element.Methods = {
/**
* Element.cumulativeScrollOffset(@element) -> Array
*
* Calculates the cumulative scroll offset of an element in nested
* scrolling containers.
* Calculates the cumulative scroll offset (in pixels) of an element in
* nested scrolling containers.
*
* Returns an array in the form of `[leftValue, topValue]`. Also accessible
* as properties: `{ left: leftValue, top: topValue }`.
*
* ##### Example
*
* Assuming the div `foo` is at scroll offset (0,257), then:
*
* var offset = $('foo').cumulativeOffset();
* offset[0];
* // -> 0
* offset[1];
* // -> 257
* offset.left;
* // -> 0
* offset.top;
* // -> 257
**/
cumulativeScrollOffset: function(element) {
var valueT = 0, valueL = 0;