There is a css way of doing this using scroll-behavior. Add the following property.
scroll-behavior: smooth;
And that is it. No JS required.
a {_x000D_
display: inline-block;_x000D_
width: 50px;_x000D_
text-decoration: none;_x000D_
}_x000D_
nav, scroll-container {_x000D_
display: block;_x000D_
margin: 0 auto;_x000D_
text-align: center;_x000D_
}_x000D_
nav {_x000D_
width: 339px;_x000D_
padding: 5px;_x000D_
border: 1px solid black;_x000D_
}_x000D_
scroll-container {_x000D_
display: block;_x000D_
width: 350px;_x000D_
height: 200px;_x000D_
overflow-y: scroll;_x000D_
scroll-behavior: smooth;_x000D_
}_x000D_
scroll-page {_x000D_
display: flex;_x000D_
align-items: center;_x000D_
justify-content: center;_x000D_
height: 100%;_x000D_
font-size: 5em;_x000D_
}
_x000D_
<nav>_x000D_
<a href="#page-1">1</a>_x000D_
<a href="#page-2">2</a>_x000D_
<a href="#page-3">3</a>_x000D_
</nav>_x000D_
<scroll-container>_x000D_
<scroll-page id="page-1">1</scroll-page>_x000D_
<scroll-page id="page-2">2</scroll-page>_x000D_
<scroll-page id="page-3">3</scroll-page>_x000D_
</scroll-container>
_x000D_
PS: please check the browser compatibility.