From f1f6fca60b636339a0356ad00b34ef763d7eae55 Mon Sep 17 00:00:00 2001 From: tjcrowder Date: Fri, 9 Oct 2009 17:01:40 +0100 Subject: [PATCH] doc: Clarified units in Element.cumulativeOffset and added example. --- src/dom/dom.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/dom/dom.js b/src/dom/dom.js index ec3631c..6806c52 100644 --- a/src/dom/dom.js +++ b/src/dom/dom.js @@ -1124,10 +1124,24 @@ Element.Methods = { * Element.cumulativeOffset(@element) -> Array * * Returns the offsets of `element` from the top left corner of the - * document. + * document, in pixels. * * Returns an array in the form of `[leftValue, topValue]`. Also accessible * as properties: `{ left: leftValue, top: topValue }`. + * + * ##### Example + * + * Assuming the div `foo` is at (25,40), then: + * + * var offset = $('foo').cumulativeOffset(); + * offset[0]; + * // -> 25 + * offset[1]; + * // -> 40 + * offset.left; + * // -> 25 + * offset.top; + * // -> 40 **/ cumulativeOffset: function(element) { var valueT = 0, valueL = 0;