Open Voltra opened 1 year ago
This is a good idea however it has an huge impact on performance since it requires getComputedStyle()
. For that reason i don't want to include it by default in the package but you can do it by yourself using scrollTo(value,{offset: scrollMarginValue})
.
Gotcha, maybe in the future we could have a flag in the constructor to enable automating this?
Describe the bug When using
Lenis#scrollTo
to scroll to an element, thescroll-margin
and/orscroll-padding
properties are ignored, thus making it scroll beyond the desired point.To Reproduce This minimal codepen.
Desired Behavior
scroll-margin
andscroll-padding
should be used when determining where to stop scrolling (like the nativeElement#scrollIntoView
does).