Replaced getOffsets, used it in showElementPopup