In order to estimate the exact distance, we have to know the way large the brand new father or mother function was
The first step to locating the father or mother is to get the new kid. cardElem.current becomes all of us the fresh new DOM node into Cards (i.e. the child). We following obtain the mother node with… anticipate they… parentNode . The brand new getBoundingClientRect() approach usually go back some properties about the nodes size and standing ( leftover , most useful , best , bottom , x , y , thickness , and you will level ). Continue reading