You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just purchased my pro license and loving it! Great work @alvarotrigo. I am interested in listening for the state changes on the dragAndMove extension for when dragging is actively happening, even if the drag is not enough to trigger a section transition. I see in the minified source mentions of onDrag and onScroll and was curious if these are publicly reachable somehow? Thanks!
The text was updated successfully, but these errors were encountered:
Sounds good. FWIW, if anyone else is trying to do this (I have elements on the page that I want to shift based on the active drag), here is the workaround I've been doing:
Add event listeners to touchmove, touchstart, and touchend to each of your sections or to the entire window.
In touchmove, obtain the drag delta of the current section with sectionElem.getBoundingClientRect().top. Use this to calculate and adjust other elements accordingly. Note: I had CSS transition effects on these elements to apply animations during onLeave events (i.e. if you do a fast swipe and release, then the only way to animate these floating elements would be to trigger something during a fullpage lifecycle event like onLeave). I had to remove the transition styles in touchstart and reapply them in touchend otherwise the translation logic I was applying in realtime during the drag itself was too sluggish.
To detect if a drag resulted in a section change or not (i.e. to "snap back" any of your shifted elements), I am currently having to use a setTimeout to detect if the active section changed (by storing the previous value and comparing it to destination.index in onLeave). You have to add the delay because your finger lift will trigger touchend immediately, but it looked like onLeave was the earliest lifecycle callback available which hasn't quite fired at that point. This was the point where I jumped in here in hopes of finding something more durable, but at the moment this approach is working well enough for our purposes.
Just purchased my pro license and loving it! Great work @alvarotrigo. I am interested in listening for the state changes on the dragAndMove extension for when dragging is actively happening, even if the drag is not enough to trigger a section transition. I see in the minified source mentions of
onDrag
andonScroll
and was curious if these are publicly reachable somehow? Thanks!The text was updated successfully, but these errors were encountered: