function getVisibleBounds(body, target) {
  if (target === document.body) {
    return { top: pageYOffset, left: pageXOffset, height: innerHeight, width: innerWidth };
  } else {
    const bounds = getBounds(body, target);

    const out = {
      height: bounds.height,
      width: bounds.width,
      top: bounds.top,
      left: bounds.left
    };

    out.height = Math.min(out.height, bounds.height - (pageYOffset - bounds.top));
    out.height = Math.min(out.height, bounds.height - ((bounds.top + bounds.height) - (pageYOffset + innerHeight)));
    out.height = Math.min(innerHeight, out.height);
    out.height -= 2;

    out.width = Math.min(out.width, bounds.width - (pageXOffset - bounds.left));
    out.width = Math.min(out.width, bounds.width - ((bounds.left + bounds.width) - (pageXOffset + innerWidth)));
    out.width = Math.min(innerWidth, out.width);
    out.width -= 2;

    if (out.top < pageYOffset) {
      out.top = pageYOffset;
    }
    if (out.left < pageXOffset) {
      out.left = pageXOffset;
    }

    return out;
  }
}
Gets bounds for when target modifiier is 'visible
@param target
@return {{top: *, left: *, width: *, height: *}}