Stanko/animated-scroll-to

Add note about scroll-behaviour: smooth to readme

kapoko opened this issue ยท 3 comments

Having scroll-behaviour set to smooth in css:

:root {
  scroll-behaviour: smooth
}

is breaking / delaying this plugins' animation (in Chrome). Found out after some trial and error that this is the default in bootstrap-5.0.0@beta2. Same thing is happening with similar packages.

Example: https://codepen.io/kapoko/pen/rNWbXxN

This setting is probably gonna be used more often. You think it's worth mentioning in the docs?

Hello @kapoko,
That is a good catch! I'll add it to the documentation. I'll also check if it can be detected via javascript to print a warning in the console.

Cheers!

It seems it can be detected like this:

getComputedStyle(document.documentElement).getPropertyValue('scroll-behavior') // -> "smooth"

I'll test it more to check cross browser support and release a new version this week.