src/common/element-scroll/index.js
function scroll(el) {
    if (!el) {
        return;
    }

    const parentEl = el && el.parentElement;
    const offsetBottom = el.offsetTop + el.offsetHeight;
    const scrollBottom = parentEl.scrollTop + parentEl.offsetHeight;

    if (el.offsetTop < parentEl.scrollTop) {
        parentEl.scrollTop = el.offsetTop;
    } else if (offsetBottom > scrollBottom) {
        parentEl.scrollTop = offsetBottom - parentEl.offsetHeight;
    }
}
function scroll(el) {
    if (!el) {
        return;
    }

    const parentEl = el && el.parentElement;
    const offsetBottom = el.offsetTop + el.offsetHeight;
    const scrollBottom = parentEl.scrollTop + parentEl.offsetHeight;

    if (el.offsetTop < parentEl.scrollTop) {
        parentEl.scrollTop = el.offsetTop;
    } else if (offsetBottom > scrollBottom) {
        parentEl.scrollTop = offsetBottom - parentEl.offsetHeight;
    }
}
function scroll ( el ) { if ( ! el ) { return ; } const parentEl = el && el . parentElement ; const offsetBottom = el . offsetTop + el . offsetHeight ; const scrollBottom = parentEl . scrollTop + parentEl . offsetHeight ; if ( el . offsetTop < parentEl . scrollTop ) { parentEl . scrollTop = el . offsetTop ; } else if ( offsetBottom > scrollBottom ) { parentEl . scrollTop = offsetBottom - parentEl . offsetHeight ; } }
Scrolls the parent element until the child element is in view
Scrolls the parent element until the child element is in view