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.
Fixed in 2.2.0
, I just published it ๐
Code:
https://github.com/Stanko/animated-scroll-to/blob/master/src/animated-scroll-to.ts#L196-L203
Tests:
https://github.com/Stanko/animated-scroll-to/blob/master/cypress/integration/scroll-element.js#L116-L132
https://github.com/Stanko/animated-scroll-to/blob/master/cypress/integration/scroll-window.js#L130-L147