position()
Returns information about the position (see NodePosition) of the first element in a result set (see results), excluding margins.
To include margins, call position(true)
.
position(Boolean)
Returns information about the position of the first element in a result set, including margins if the passed Boolean is true
, or excluding margins if it is omitted or false
.
Example
<h1>Section 1</h1>
<p> Lorem ipsum dolor... </p>
<div id="foobar" style="width: 740px; height: 48px;"> Foobar </div>
The following script, with the selector #foobar
retrieves the position of the Div element with the id #foobar.
var pos = results.position();
The retrieved position could be used to draw an absolute positioned box on top of the Div, for example.