You must indicate whether you want it to scroll smoothly or simply jump to an element. Jumping is easy and can only be done using HTML or Javascript. The simplest is to use binding. The limitation is that every element you want to scroll must have id . A side effect is that #theID will be added to the URL
<a href="#scroll">Go to Title</a> <div> <h1 id="scroll">Title</h1> </div>
You can add CSS effects to the target by clicking a link using the CSS :target selector.
With some basic JS, you can do more, namely the scrollIntoView() method. Elements do not need an identifier, although it is even simpler, for example
function onLinkClick() { document.getElementsByTagName('h2')[3].scrollIntoView();
Finally, if you need smooth scrolling, you should take a look at JS Smooth Scroll or this snippet for jQuery. (NB: there may be many others).
source share