Show:

bui.touch Class

兼容PC的拖拽事件库

Item Index

Methods

Methods

dragable

(
  • x
  • y
  • [direction] [ 移动的方向, 默认根据全局配置的方向]
  • [el] [ 移动的对象,id,样式,或者dom 默认根据全局配置的id, 可不传]
  • [onBeforeDragstart] [ 进入touchstart前的回调]
  • [onBeforeDragmove] [ 进入touchmove前的回调]
  • [onBeforeDragend] [ 进入touchend前的回调]
  • [onDragstart] [ 开始拖动的回调]
  • [onDragmove] [ 移动中的回调]
  • [onDragend] [ 移动后的回调]
)

拖动

Parameters:

  • x String

    [ 移动的横向距离 ]

  • y String

    [ 移动的纵向距离 ]

  • [direction] [ 移动的方向, 默认根据全局配置的方向] String optional
  • [el] [ 移动的对象,id,样式,或者dom 默认根据全局配置的id, 可不传] String | Object optional
  • [onBeforeDragstart] [ 进入touchstart前的回调] Function optional
  • [onBeforeDragmove] [ 进入touchmove前的回调] Function optional
  • [onBeforeDragend] [ 进入touchend前的回调] Function optional
  • [onDragstart] [ 开始拖动的回调] Function optional
  • [onDragmove] [ 移动中的回调] Function optional
  • [onDragend] [ 移动后的回调] Function optional

Example:

 uiTouch.off("click");
                                                

init

()

初始化

Example:

 var uiTouch = bui.touch({
                                                         id:"#parentTarget",
                                                         children:""
                                                 })
                                                

move

(
  • x
  • y
  • [direction] [ 移动的方向, 默认根据全局配置的方向]
  • [el] [ 移动的对象,id,样式,或者dom 默认根据全局配置的id, 可不传]
)

移动

Parameters:

  • x String

    [ 移动的横向距离 ]

  • y String

    [ 移动的纵向距离 ]

  • [direction] [ 移动的方向, 默认根据全局配置的方向] String optional
  • [el] [ 移动的对象,id,样式,或者dom 默认根据全局配置的id, 可不传] String | Object optional

Example:

 uiTouch.off("click");
                                                

off

(
  • type
)

关闭事件

Parameters:

  • type String

    [ "click" "drag" ]

Example:

 uiTouch.off("click");