Last Updated: February 25, 2016
·
516
· drfranca

getBoundingClientRect

Em muitas situações somente o offset não resolve nossos problemas, principalmente quando o posicionamento que precisamos é relativo ao client, ou seja, afetado por scroll e position.

Com a função getBoundingClientRect, temos todas as seguintes informações, relativas ao client.

bottom, height, left, right, top, width

Reference: https://developer.mozilla.org/en-US/docs/Web/API/element.getBoundingClientRect