Witam,
Chciałbym osiągnąć efekt podobny do tego: https://xaviercusso.com/#/project/stoooorm
Chodzi o to, że podczas scrollowania numerki obok grafik scrollują się z różną prędkością, tak że są na dole obrazka, kiedy ten wychodzi z viewportu.
const scrollHandler = (containerHeight, scrollableElementHeight) => {
const rect = scrollableElement.current.getBoundingClientRect()
const visibleElementY = rect.top
TweenLite.to(scrollableElement.current, 0.5, {
duration: 0.5,
ease: "expo.out",
yPercent: (visibleElementY * (scrollableElementHeight / containerHeight) )
})
}
const containerHeight = container.current.offsetHeight
const scrollableElementHeight = scrollableElement.current.offsetHeight
window.addEventListener('scroll', throttle(() => {
scrollHandler(containerHeight, scrollableElementHeight)
}, 200))