EDITABLE CODE:
LiveDemo:jQuery - offsetParent() Method
Note:This method works its way up the hierarchy until it reaches an element with one of the required values.