Use offset property instead of getBoundingClientRect.