$(selector).offsetParent()
The .offsetParent() method traverses along the DOM tree and searches through the ancestors of the selected element and construct a new jQuery object wrapped around the closest positioned ancestor. The DOM element's position can be positioned using the CSS position attributes such as relative, absolute, or fixed. This method is useful to calculate the offsets for performing animations and placing objects on the page.
Here is a brief example code on how to use the jQuery offsetParent() method.