added example of a bug when the parent element has an offset and implemented solution