O'Reilly logo

jQuery and JavaScript Phrasebook by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required