npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

el-dragmove

v0.0.3

Published

drag move element.

Downloads

18

Readme

使用文档 | Usage

拖动模型.gif

在线demo | Online Demo

使用示例

CDN方式使用 | Using with CDN

<div id="rect-1" class="rect">1</div>

<script src="https://unpkg.com/el-dragmove@latest/dist/index.min.js"></script>
<script>
  const targetEl = document.getElementById('rect-1')
  const moveModel = new DragMoveModel({ targetEl: targetEl }, (x, y, z) => console.log(x, y, z))
</script>

模块化项目中使用 | Using in Project

  1. 安装 | install
npm i el-dragmove@latest -S
  1. 引入 | import el-dragmove
import Dragmove from 'el-dragmove/dist/es'

const el = document.getElementById('test')
const elDragmove = new Dragmove({
  targetEl: el
})

// 销毁监听事件
// elDragmove.destroy()

构造函数初始化参数 | Initialize some parameters

  • config,个性化配置
  • callback, 回调函数,获取鼠标移动距离

config参数配置 | config`s properties

| 属性 property | 说明 description | 类型 type | 默认值 defalut | 可选值 optional | | --- | --- | --- | --- | --- | | targetEl | 目标元素,需要拖动的元素The element that needs to be dragged | HTMLElement | document.body | | | limitMoveBorder | 是否限制拖动边界Whether to restrict drag boundaries | Boolean | false | | | moveMode | 拖动实现方式,transform为transform-translate方式移动,position为top,left方式移动Drag implementation | String | transform |transform,position | | h5 | 是否是h5Whether it is H5 or not | Boolean | false | | | disableMoveEl | 是否限制移动Whether to restrict movement | Boolean | false | | | maxMoveX | x轴最大移动距离Maximum distance traveled on the x-axis | Number | 1000000 | | | maxMoveY | y轴最大移动距离Maximum distance traveled on the y-axis | Number | 1000000 | |

销毁方法 | Destroy

moveModel.destroy()

实现原理解析 | How to implement

https://juejin.cn/post/7165405623725588493