baptistebriel / smooth-scrolling

smooth scrolling and parallax effects on scroll
MIT License
612 stars 75 forks source link

[fixes] - FF + IE & [improvement] - destroy() #69

Closed jackismissing closed 7 years ago

jackismissing commented 7 years ago

On IE < Edge, this.constructor.name doesn't exist. A fix would be to default that value to 'Smooth'. One side effect I noted is that on IE11 it will break the extend.

On Firefox it seems that when canceling a RAF, old entries in the callbacks list are still being executed rather than being destroyed. To prevent this, we can set a flag that prevents any call to the RAF's callback function when the RAF is canceled.

Lastly, when calling destroy() the current scroll value is not reset to 0, which can cause some issues where elements rely on that value (like animating an image based on the scroll in a RAF) even though the scroll is destroyed. Setting the vars.current to 0 in the destroy() would allow for a proper removal of the scroll.

🍻

baptistebriel commented 7 years ago

Thanks @jackismissing ! 🍻 😘