rootMargin must have pixel or percentage unit, but the “Trigger Animations” example uses a rootMargin of "-100px 0" which throws an error.
brandondurham opened this issue · comments
Bug Report
Describe the Bug
In the README file the Trigger Animations example uses a value of "-100px 0"
for rootMargin
, but rootMargin
requires absolute pixel or percent units, otherwise it throws the following error:
Failed to construct 'IntersectionObserver': rootMargin must be specified in pixels or percent.
How to Reproduce
Just follow the example set in the Trigger Animations section of the README.
CodeSandbox Link
https://codesandbox.io/s/react-cool-inview-example-forked-bcf57
Expected Behavior
0
shouldn’t require a unit.
Screenshots
Add screenshots to help explain your problem.
Your Environment
- Device: MacBook
- OS: macOS BigSur 11.1
- Browser: Chrome
- Version: 89.0.4389.90 (Official Build) (x86_64)
Referenced here: w3c/IntersectionObserver#453
@brandondurham Sorry for the late reply, I have updated the READ.md.
Thank you!