1.2.2 • Published 5 years ago

drag-block v1.2.2

Weekly downloads
2
License
BSD-2-Clause
Repository
github
Last release
5 years ago

drag-block

一个简单的、将所有设置定位的元素变为可拖拽的小工具。

Installation

通过npm安装:

$ npm i -S drag-block

或直接获取源码:

Releases

Usage

在项目中import(ES6 modules)

import DragBlock from 'drag-block'

或在html中用引入源码中的lib/drag-block.js

<script src="drag-block.js"></script>

然后在js中使用:

let drag = new DragBlock(DomElement[, options])

可以监听相应的事件:

drag.on('dragStart', target => {
  console.log(target.style.left)
})

其中DomElement是需要可拖拽的position: fixed | absolute | reletive元素,options是选项对象。

本工具不负责处理目标元素的样式之类

Options

参数说明类型默认值
useDragBar是否使用弹出的拖拽条,false时直接拖拽目标本体Booleantrue

更多功能和配置项后续添加~欢迎提交issue

Events

事件名称说明回调参数
dragStart点击bar或者本体开始拖动时触发目标dom
dragEnd拖动结束时触发目标dom

Example

https://kinice.github.io/drag-block/

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago