Is it possible to listen to attach the scroll event to Smooth Scrollbar ?
I started using it everywhere abut I'm limited with scroll magic because of the normal scroll. With scroll magic and smooth scrollbar the whole experience for the user will be perfect (no more jumpy animations). For now I'm writing my own js code for triggering animations and progressing animations by scroll position etc. But it would be awesome to have the power of Scroll Magic with smooth scrolling
Thanks!
I used smooth scrollbar with ScrollMagic by disabling the refreshInterval (better performance) and refresh the scene instance manually on every custom scroll event triggered by smooth scrollbar. In this way, the trigger element positions get updated smoothly.
// initialize controller
var controller = new ScrollMagic.Controller({
refreshInterval: 0
})
// add a scene
var scene = new ScrollMagic.Scene(...)
// ...
.addTo(controller)
// intialize scrollbar
var scrollbar = SmoothScrollbar.init(document.querySelector('#main'))
// add listener to refresh the scene manually
scrollbar.addListener(() => {
scene.refresh()
})
Is it possible to get scrollDirection with smooth scrollbar? I keep getting "PAUSED"?
Hello @cpuldev, @oncode,
I have got some strange lags on Safari and sometimes on Firefox with this method.
Here is a codepen : https://codepen.io/luluberlu/pen/gZGwoW
On Chrome, all seem ok (but i prefer update controller, better performance)
What's going wrong ?
Thanks,
Lucien
It doesn't works when you pin a scene.
Position top is equal to zero but it should be scrollbar.scrollTop.
How can we achieve this?
Most helpful comment
I used smooth scrollbar with ScrollMagic by disabling the
refreshInterval(better performance) and refresh the scene instance manually on every custom scroll event triggered by smooth scrollbar. In this way, the trigger element positions get updated smoothly.