electerious / basicScroll

Standalone parallax scrolling for mobile and desktop with CSS variables.
https://basicscroll.electerious.com
MIT License
3.63k stars 148 forks source link

Featured Request: Callbacks for before and after #38

Closed JiveDig closed 5 years ago

JiveDig commented 5 years ago

First off, just found basicScroll and instantly loved it... nice work! I've spent a lot of time with ScrollMagic (really powerful) but really like the lightweight/variable approach here.

I'm thinking it would still be efficient but much more powerful/flexible to have a callback function when an instance/element was before and/or after inside/tracking.

I'm doing some trickery, as I should be with a library like this ;P - and want to do some stuff when outside the target but only after I have scrolled past it. So far, haven't found a logical and efficient way to do this without a lot of other code.

electerious commented 5 years ago

Hey @JiveDig, what's wrong with the current inside/outside callbacks? https://github.com/electerious/basicScroll#data

JiveDig commented 5 years ago

Hey @electerious those callbacks are amazing, and fit loads of use-cases. Maybe this screenshot will help clarify a little more power being added to basicScroll:

cb4991be15435adefb50d647d8d1abe9 _image 202019-02-19 20at 2012 09 13 20pm

electerious commented 5 years ago

inside and outside are passing a percentage value to the function. 0% in outside should be before and 100% should be after. Could be worth a try.

A dedicated callback for before and after isn't planned.

JiveDig commented 5 years ago

Ahh I must have missed it when i console.log() the percentage in the outside callback. It shows a negative percentage before, that's awesome. This is perfect, I can do everything I need as-is. Thanks!