Scrollto Element według ID Center

// scroll to specified element. accepts params to choose scroll type, position on page etc
document.getElementById("divFirst").scrollIntoView();
// scrolls smoothly and centers div:
document.getElementById("divFirst").scrollIntoView({behavior: "smooth", block: "center"});
// for all param options visit developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
Literate Lentil