gesturejs

0.1.1 • Public • Published

lib-gesture

gesturejs helps to recognize multiple screen touch gestures like pan, swipe, tap and longpress etc.

最新版本

0.1.0

安装

npm install gesturejs

用Grunt打包

运行 grunt,来对项目进行打包。关于Grunt的知识,请参见gruntjs;

如何使用

引入js文件后,任何DOM结点都可以监听手势事件。例如:

document.querySelector('.viewport').addEventListener('pan', function(){
	console.log('getsture pan');
}, false);

手势事件有:

  • tap 轻击
  • doubletap 快速双击
  • panstart 开始平移
  • horizontalpanstart 开始水平平移
  • verticalpanstart 开始垂直平移
  • panmove 平移中
  • horizontalpan 水平平移中
  • verticalpan 垂直平移中
  • panend 平移结束
  • swipe 轻弹
  • horizontalswipe 水平轻弹
  • verticalswipe 垂直轻弹
  • longpress 长按
  • pressend 长按结束

npm版对原版lib-gesture所做的变动如下:

  • pan -> panmove
  • flick -> swipe
  • horizontalflick -> horizontalswipe
  • verticalflick -> verticalswipe
  • press -> longpress

Readme

Keywords

Package Sidebar

Install

npm i gesturejs

Weekly Downloads

3

Version

0.1.1

License

none

Last publish

Collaborators

  • mr.raindrop