code: function($child, $parent) {
    if (! $child) {
      return;
    }
  
    // make sure it's inside the visible area
    let parentTop    = $parent.offset() && $parent.offset().top;
    let parentHeight = $parent.height();
    let childTop     = $child.offset() && $child.offset().top;
    let childHeight  = $child.height();
  
    // check if bottom is below visible part
    if (childTop + childHeight > parentTop + parentHeight) {
      let amount = $parent.scrollTop() +
        (childTop + childHeight - (parentTop + parentHeight));
      $parent.scrollTop(amount);
    }
  
    // check if top is above visible section
    if (childTop < parentTop) {
      $parent.scrollTop($parent.scrollTop() + childTop - parentTop);
    }
  }
docs: scroll $parent to make sure $child is visible XXX doesn't work that well, needs improvement