Element.scrollIntoViewIfNeeded()

Element.scrollIntoViewIfNeeded()

If the element is fully within the visible area of the viewport, it does nothing. Otherwise, the element is scrolled into view. A proprietary variant of the standard Element.scrollIntoView() method.

Spec https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoViewIfNeeded
Status Unofficial / Note
IE Edge Firefox Chrome Safari Opera