Drag.Flick 0.1

Drag extension that adds momentum to the dragged object: after the object is released it decelerates instead of stopping immediately. This mimics the flick gesture of certain popular touch interfaces.

Thanks to Drag's versatile design, this can also be used to make elements scroll like butter.



Details

Author
Ben Lenarts
Current version
0.1
GitHub
benlenarts/Drag.Flick
Downloads
1792
Category
Interface
Tags
Report
GitHub Issues

Releases


Dependencies

  • _self_/_current_:
    • Fx.Push
    • more/1.2.4.2: Drag
    • core/1.2.4: [Fx, Element.Style]

How to use

Simply instantiate Drag.Flick where you would normally use Drag:

var myDrag = new Drag.Flick('anElement');

This extension inherits all the options and events from Drag and adds the following:

  • friction: controls how fast the object will decelerate after it's been released (default: 0.1)
  • bounce: controls how much the object will 'bounce' off the drag limits after it's been released (default: 0)
  • onMoveEnd: Executed when the dragged element comes to a full stop.