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
I'd like to use draggabilly for a swipe-to-dismiss feature, similar to gmail on Android. I've built a demo and I think that draggabilly performs and feels quite nice. It performs better and required much less code than using hammer.js. However...
When the elements fill the view, you can only scroll by dragging the small space between the elements, even though draggabilly is restricted to the x-axis.
// duck punch Draggabillyvarproto=Draggabilly.prototype;varpointerMove=proto.pointerMove;proto.pointerMove=function(event,pointer){varmoveVector=this._dragPointerMove(event,pointer);this.touchVerticalScrollMove(event,pointer,moveVector);pointerMove.apply(this,arguments);}proto.hasDragStarted=function(moveVector){return!this.isTouchScrolling&&Math.abs(moveVector.x)>3;};proto.canPreventDefaultOnPointerDown=function(){returnfalse;};vartouchScrollEvents={touchmove: true,MSPointerMove: true};proto.touchVerticalScrollMove=function(event,pointer,moveVector){varisTouchScrollEvent=touchScrollEvents[event.type];// start scrolling if touch event and y moved 10pxif(this.options.touchVerticalScroll&&isTouchScrollEvent&&!this.isTouchScrolling&&Math.abs(moveVector.y)>10){this.isTouchScrolling=true;}};varpointerUp=proto.pointerUp;proto.pointerUp=function(){pointerUp.apply(this,arguments);deletethis.isTouchScrolling;};
But now that we have enabled scrolling, users can scroll to the right by dragging an item to the right.
At this point, the logic is different enough that I would consider writing your own Draggabilly-like class on top of Unidragger, rather than re-writing Draggabilly to do it.
I'd like to use draggabilly for a swipe-to-dismiss feature, similar to gmail on Android. I've built a demo and I think that draggabilly performs and feels quite nice. It performs better and required much less code than using hammer.js. However...
When the elements fill the view, you can only scroll by dragging the small space between the elements, even though draggabilly is restricted to the x-axis.
Mobile test case: http://codepen.io/okfuture/pen/KVbYLr?editors=0010
Is there a way to allow default scroll behavior for the y-axis when restricted to x-axis?
The text was updated successfully, but these errors were encountered: