Enter a search term above to see results...
On This Page
Query - Utilities
Size and position methods in Query allow you to get information about element dimensions, scroll positions, and their position in the DOM.
count
Get the number of elements in the Query object.
Count Usage -
count()
is preferred although the Query object isarray-like
andlength
will also work. If it’s really important to you — you can still do that.
Syntax
Returns
number
- The number of elements in the Query object.
Usage
index
Get the index of an element in the set of matched elements.
DOM Position -
index()
is useful for determining the position of an element among its siblings.
Syntax
Returns
number
- The index of the first element within the Query object relative to its sibling elements, or -1 if not found.
Usage
offsetParent
Get the closest positioned ancestor element.
Edge-Case Improvements -
offsetParent()
handles some [edge cases}(https://issues.chromium.org/issues/41131675) that prevent the naive use ofel.offsetParent
Syntax
Parameters
Name | Type | Description |
---|---|---|
options | Object | Configuration options for the method |
Returns
Query object containing the offset parent element(s).