back to Overview

.offset()

Returns the pixel page coordinates of the list's first element.

Syntax

list.offset()

Parameters

element
the element whose coordinates should be determined
(return value)
an object containing pixel coordinates in two properties 'x' and 'y'

Description

Returns the pixel page coordinates of the list's first element. Page coordinates are the pixel coordinates within the document, with 0/0 being the upper left corner, independent of the user's current view (which depends on the user's current scroll position and zoom level).

Example

Displays the position of the element with the id 'myElement' in the element 'resultElement':

var pos = $('#myElement').offset();
$('#resultElement').ht('#myElement's position is left={x} top={y}', pos);

See also..

  • get() can be used to read more general properties of a list element.

Comments

comments powered by Disqus

back to Overview

Functions