Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find elements by offset position with jQuery

Is there a simple method to fetch all elements at a specific offset position (by using jQuery)? Or do I have to check the offset of each element in the DOM?

like image 584
Zardoz Avatar asked Jan 19 '11 00:01

Zardoz


People also ask

How does jQuery calculate offset value?

jQuery offset() MethodThe offset() method set or returns the offset coordinates for the selected elements, relative to the document. When used to return the offset: This method returns the offset coordinates of the FIRST matched element. It returns an object with 2 properties; the top and left positions in pixels.

What is offsetHeight in jQuery?

offsetHeight read-only property returns the height of an element, including vertical padding and borders, as an integer. Typically, offsetHeight is a measurement in pixels of the element's CSS height, including any borders, padding, and horizontal scrollbars (if rendered).

What is the difference between position and offset in jQuery?

Although both methods have some similarities, but the jQuery offset() method is different from the jQuery position() method. The offset() method retrieves the current position relative to the document, whereas the position() method retrieves the current position of an element relative to the parent element.

What is offset () Top?

Definition and Usage The offsetTop property returns the top position (in pixels) relative to the parent. The returned value includes: the top position, and margin of the element.


1 Answers

Call document.elementFromPoint.

like image 115
SLaks Avatar answered Oct 08 '22 01:10

SLaks