jQuery offsetParent () method
Examples
Background color <p> element is positioned nearest parent element:
$("button").click(function(){
$("p").offsetParent().css("background-color","red");
});
$("p").offsetParent().css("background-color","red");
});
try it"
Definition and Usage
offsetParent () method returns the first element is positioned parent.
Tip: Elements can be positioned by jQuery or CSS position property (relative, absolute or fixed).
grammar
$(selector).offsetParent()