Add these to your HTML:
<script src="https://unpkg.com/smoothscroll-polyfill/dist/smoothscroll.min.js"></script> <script src="https://unpkg.com/smoothscroll-anchor-polyfill"></script>
and add font-family everywhere you set scroll-behavior:
font-family
scroll-behavior
html { scroll-behavior: smooth; font-family: 'scroll-behavior: smooth' /*, actual fonts */; }
The first polyfill generally polyfills scroll({ behavior: 'smooth'), the second one (disclosure: written by me) syncs it up with the CSS. 👍🏻
scroll({ behavior: 'smooth')
If you don't like the font-family stuff, you can also run your styles through PostCSS with this – or just use an inline style attribute on html:
<html style="scroll-behavior: smooth">
The workaround is not required there. :)
Full docs: jonaskuske.github.io/smoothscroll-... ⚓
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Add these to your HTML:
and add
font-family
everywhere you setscroll-behavior
:The first polyfill generally polyfills
scroll({ behavior: 'smooth')
, the second one (disclosure: written by me) syncs it up with the CSS. 👍🏻If you don't like the
font-family
stuff, you can also run your styles through PostCSS with this – or just use an inline style attribute on html:The workaround is not required there. :)
Full docs: jonaskuske.github.io/smoothscroll-... ⚓