solution 1:
you can use .parentNode to get parent (if you don't have directly access to parent), then get height of parent, it have to be same as part of the child div still in the parent div, something like:
document.getElementById("#id).parentNode.style.height
solution 2: (this will work even if child div moved)
if access to parent is not the problem, you need a more accurate solution, you can get coordinate of parent and child, then with a little math you have exact part of child in parent div...
let parentCoord = document.getElementById('parentId').getBoundingClientRect();
let childCoord = document.getElementById('childId').getBoundingClientRect();
var left = Math.max(parentCoord.left, childCoord.left);
var right = Math.min(parentCoord.right, childCoord.right);
var top = Math.max(parentCoord.top, childCoord.top);
var bottom = Math.min(parentCoord.bottom, childCoord.bottom);
now you have exact coords of that part of child in parent div, if you need a width you can do a simple math:
var width = right - left;
var height = bottom - top;
if this is not what you need then we need a little more details about what you are trying to do...
if this is, then enjoy codding...