huyue-touch-event

1.0.34 • Public • Published

使用说明

方法对touch的信息做了一些搜集

    this.info.x ='0'; //x 轴移动距离;
    this.info.y ='0'; //y 轴移动距离;
    this.info.contX = 0; //X 轴滚动的累加值
    this.info.contY = 0; //Y 轴滚动的累加值
    this.info.isx =''; //x 轴的移动方向
    this.info.isy =''; //y 轴的移动方向
  1. 安装
npm i huyue-touch-event -save
  1. 更新
npm update huyue-touch-event
  1. 引入
import ZSwiperMaker from 'huyue-touch-event'
  1. 使用
        let scrllDom = {
            //非必填 默认 false 是否阻止start,move ,end方法发生默认的行为
            startPreventDefault : false,   
            movePreventDefault : false,
            endPreventDefault : false,
            
            //非必填 默认 false  是否停止start,move ,end事件的传播,阻止它被分派到其他 Document 节点
            startStopPropagation : false, 
            moveStopPropagation : false,
            endStopPropagation : false, 

            //非必填 默认 false  , true事件句柄在捕获阶段执行  false- 事件句柄在冒泡阶段执行
            startBubbling : false, 
            moveBubbling : false,
            endBubbling : false,

            //必填
            dom : $('.div')[0],  //要绑定的dom
            //非必填 touchstart 回调事件
            start: function(res){
                console.log('start',res)
            },
            //非必填 touchmove 回调事件
            move: function(res){
                console.log('move',res)
            },
            //非必填 touchend 回调事件
            end: function(res){
                console.log('end',res)
            }
        }
        let touchInfo  = new ZSwiperMaker(scrllDom)

Readme

Keywords

none

Package Sidebar

Install

npm i huyue-touch-event

Weekly Downloads

1

Version

1.0.34

License

ISC

Unpacked Size

11.2 kB

Total Files

4

Last publish

Collaborators

  • piappcn