jQuery CSS Operation - offsetParent() Method
Example
Set the background color of the nearest ancestor positioned element:
$("button").click(function(){ $("p").offsetParent().css("background-color","red"); });
Definition and Usage
The offsetParent() method returns the nearest ancestor positioned element.
Positioned elements refer to elements whose CSS position property is set to relative, absolute, or fixed.
You can set the position with jQuery or through the CSS position property.
Syntax
$(selector.offsetParent()