Getting the Positioning Parents

$("#notify").offsetParent();   //selects the element with id="notify" and then selects   //the ancestor that is used to position that element

The .offsetParent() method returns a jQuery object representing the closest ancestor element that has a CSS position attribute of relative, absolute, or fixed. This allows you to get the element used for positioning, which becomes critical when you need to get the size of the position container.

Get jQuery and JavaScript Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.