skrollr icon indicating copy to clipboard operation
skrollr copied to clipboard

JavaScript callbacks

Open apedretti opened this issue 10 years ago • 2 comments

Guys, wonderful job here.

I've used the script for a landing page, but sadly some effects could not be resolved through supported animations, they were just too particular of the page itself.

So I modified the script to support javascript callbacks on the elements, such as: data-callback-xxx-zzz xxx > [optional] starting scrolling point where the callback is to be called zzz > [optional] ending point where the callback won't be called no more

I might think that could be a powerful thing to leave open the posibility of supporting custom scripts for those who want/need to use them, but then again, I might be the only one. So, would it be any help to share the code?

P.S.: At the moment, the callback receives only the scrolling Y position. That makes unnecesary to declare the callback in a particular element, but I still think that doing so is important to keep consistency and readability (as in this callback will impact in this element), which this plugin certainly address well. Maybe in a future the second parameter received can be the element itself where the callback's been added.

apedretti avatar Oct 26 '14 00:10 apedretti

You can already to the same thing with keyframe events https://github.com/Prinzhorn/skrollr#keyframe which also gives you the direction and element.

Prinzhorn avatar Oct 27 '14 18:10 Prinzhorn

@apedretti how can I get your script?

filipecunha avatar May 16 '16 19:05 filipecunha