Search code examples
githubsmooth-scrolling

Smooth scrolling on github readme


I have a github repository with README.md file. The file has anchor links, and when i click, the page immediately scrolls to anchor. How can i make that smooth. I also have github pages one, in which i also want smooth scrolling. I can make .html file and add it to gihub pages, but it'll not work when you open a repository. Is there a way to make scrolling smooth in github repository's readme?


Solution

  • In general, this is a property of your browser, and whether the browser scrolls the page this way is an implementation detail of the browser and its settings. It may be possible to change this with JavaScript, but for security reasons, GitHub ignores JavaScript in READMEs, so you can't change it there.

    Since there is a potentially significant performance impact with enabling smooth scrolling, it's better to let each user choose how to configure their own browser instead of trying to force this on them.