parentNode:直接父级
offsetParent:类似于css的包含块(根据本身定位及父级定位来确认offsetParent的目标元素)
offsetParent的作用:
offsetLeft 和 offsetTop 是参照于offsetParent 的内边距边界的
dom里面所有元素都有offsetLeft 和 offsetTop
offsetParent兼容性:
offsetParent(如果body和html直接的margin被清掉)
本身定位fixed
==》 offsetParent:null(ie7以上不含火狐)
==》 offsetParent:null (火狐)
本身定位不为fixed
父级没有定位
==>offsetParent:body
父级有定位
==》offsetParent:定位父级