A framework and a collection for separate and simple implementation of touch gestures
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
momo
README.md
bower.json
momo.js
package.json

README.md

Momo (MoMotion)

  • A framework and a collection for separate and simple implementation of touch gestures

AMD and OzJS

Get the Code

Add to your project as new dependency

Or download directly from Github

Dependencies

Modules Overview

momo

  • A sample implementation for adapter

momo/base

  • A simple framework

momo/tap

  • 'tap', 'doubletap', 'hold', 'tapstart', 'tapcancel'

momo/scroll

  • 'scrolldown', 'scrollup', 'scrollstart', 'scrollend'

momo/swipe

  • 'swipeup', 'swipedown', 'swiperight', 'swipeleft'

momo/drag (beta)

  • 'drag', 'dragover', 'dragstart', 'dragend'

Examples

  • Comming soon...

API and usage

momo

var momo = require('momo');
  • momo.init() -
  • momo.tap() -
  • momo.scroll() -
  • momo.swipe() -
  • momo.drag() -

momo/base

Defaults:

  • namespace: ""
var momoBase = require('momo/base');
var MomoBase = momoBase.Class;
  • MomoBase.prototype.config --
  • MomoBase.prototype.enable --
  • MomoBase.prototype.disable --
  • MomoBase.prototype.once --
  • MomoBase.prototype.event --
  • MomoBase.prototype.SUPPORT_TOUCH --
  • MomoBase.prototype.bind -- [adapter]
  • MomoBase.prototype.unbind -- [adapter]
  • MomoBase.prototype.trigger -- [adapter]
  • MomoBase.prototype.press -- [hook]
  • MomoBase.prototype.move -- [hook]
  • MomoBase.prototype.release -- [hook]
  • MomoBase.prototype.cancel -- [hook]

momo/tap

Defaults:

  • tapRadius: 10
  • doubleTimeout: 300
  • tapThreshold: 0
  • holdThreshold: 500
var momoTap = require('momo/tap');
var tapGesture = momoTap(element, /* optional */ config, /* optional */ handler);
  • element.addEventListener('tap', handler)
  • element.addEventListener('doubletap', handler)
  • element.addEventListener('hold', handler)
  • element.addEventListener('tapstart', handler)
  • element.addEventListener('tapcancel', handler)

momo/scroll

Defaults:

  • directThreshold: 5
  • scrollEndGap: 5
var momoScroll = require('momo/scroll');
var scrollGesture = momoScroll(element, /* optional */ config, /* optional */ handler);
  • scrollGesture.watchScroll(element) -
  • element.addEventListener('scrolldown', handler)
  • element.addEventListener('scrollup', handler)
  • element.addEventListener('scrollstart', handler)
  • element.addEventListener('scrollend', handler)

momo/swipe

Defaults:

  • timeThreshold: 200
  • distanceThreshold: 20
var momoSwipe = require('momo/swipe');
var swipeGesture = momoSwipe(element, /* optional */ config, /* optional */ handler);
  • element.addEventListener('swipedown', handler)
  • element.addEventListener('swipeup', handler)
  • element.addEventListener('swipeleft', handler)
  • element.addEventListener('swiperight', handler)

momo/drag

  • Comming soon...

Under construction...

More References

See OzJS Project Homepage

Release History

See OzJS Release History

License

Copyright (c) 2010 - 2013 dexteryy
Licensed under the MIT license.