ctrl+k
Enter a search term above to see results...
Get element positions and check spatial relationships between elements.
$('selector').position()$('selector').position(options)Gets or sets element position coordinates with flexible reference systems.
| Name | Type | Description |
|---|---|---|
| relativeTo | string/Element/Query | Element to measure relative to |
| top | number | Top position to set |
| left | number | Left position to set |
| precision | 'pixel' | 'subpixel' | Rounding precision. Default: 'pixel' |
| type | 'global' | 'local' | 'relative' | Coordinate system to return |
Position object with { top, left } coordinates. Default returns all coordinate systems: { global, local, relative? }.
$('selector').pagePosition()$('selector').pagePosition({ precision: 'subpixel' })Gets element position relative to the document (viewport position + scroll offset).
| Name | Type | Description |
|---|---|---|
| precision | 'pixel' | 'subpixel' | Rounding precision. Default: 'pixel' |
Position object with { top, left } coordinates relative to document.
$('selector').intersects(target)$('selector').intersects(target, options)Checks if elements intersect with a target.
Note Uses
outerWidthandouterHeight(includes padding and border) for intersection calculations.
| Name | Type | Description |
|---|---|---|
| target | string/Element/Query | Target element(s) |
| options | object | Options |
| Name | Type | Default | Description |
|---|---|---|---|
| sides | string/array | 'all' | Sides to check: 'top', 'bottom', 'left', 'right' |
| threshold | number | 0 | Minimum intersection ratio (0-1) |
| fully | boolean | false | Source must be fully contained |
| returnDetails | boolean | false | Return detailed intersection data |
| all | boolean | false | All elements must intersect (vs any) |
Boolean, or details object when returnDetails: true.