jonaskuske / smoothscroll-anchor-polyfill

⚓ Apply smooth scroll to anchor links, polyfill scroll-behavior
https://jonaskuske.github.io/smoothscroll-anchor-polyfill
MIT License
41 stars 3 forks source link

doesnt work in IE11 #29

Closed rocifier closed 4 years ago

rocifier commented 4 years ago

Tried the font-family hack and the inline style on , IE11 just jumps to named anchors immediately.

jonaskuske commented 4 years ago

Did you load both <script src="//unpkg.com/smoothscroll-polyfill/dist/smoothscroll.min.js"></script> and <script src="//unpkg.com/smoothscroll-anchor-polyfill"></script> ? :)

rocifier commented 4 years ago

Thanks for your prompt reply. I've just tried step 2a:

I only require smooth scrolling for links to named anchors. Is there a pre-requisite of smoothscroll.min.js for that use case?

jonaskuske commented 4 years ago

Is there a pre-requisite of smoothscroll.min.js for that use case?

Yep. Or not smoothscoll-polyfill specifically, but rather any Polyfill that enables window.scroll({ behavior: 'smooth' }) and Element.scrollIntoView({ behavior: 'smooth' }) – as smoothscroll-anchor-polyfill is using that under the hood, and is itself just concerned with detecting clicks on anchors, hashchanges, updating the URL and focus management. Dropping in

<script src="//unpkg.com/smoothscroll-polyfill/dist/smoothscroll.min.js">

in addition to smoothscroll-anchor-polyfill is probably the easiest way to get started. :)

jonaskuske commented 4 years ago

Adding the above should fix your issue, if not feel free to comment again and I'll reopen :)