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

dom-slide

v2.0.3

Published

可以将页面上任一元素变成可以拖动的元素,pc wap端均可以使用,并且可以定义其移动的范围以及移动的方向,<br/> 注意事项: <br/> 1.被定义为可以移动的元素,如果其所在父容器有滚动条。在移动的过程中可能会导致其 位置不准确 <br/> 2. body容器有滚动条的时候,在移动的过程中不会影响其位置的准确性 <br/> 3. 由于字元素的层级不会比父元素层级高,在父元素hidden时 可能会导致可拖动元素被父元素遮挡<br/>

Downloads

1

Readme

dom-slide

介绍

可以将页面上任一元素变成可以拖动的元素,pc wap端均可以使用,并且可以定义其移动的范围以及移动的方向, 注意事项: 1.被定义为可以移动的元素,如果其所在父容器有滚动条。在移动的过程中可能会导致其 位置不准确 2. body容器有滚动条的时候,在移动的过程中不会影响其位置的准确性 3. 由于字元素的层级不会比父元素层级高,在父元素hidden时 可能会导致可拖动元素被父元素遮挡

vue中安装教程

  1. npm i dom-slide
  2. 使用组件内部单独引入,import {init} from 'dom-slide' 或者 import all from 'dom-slide'
  3. 在created函数初始化,init()或者all.init() created() { init(); }
  4. 在mounted函数里面注册testEvent事件,用于获取dom元素当前移动后的位置数据 mounted() { //订阅testEvent事件 window.Observer.addEventListen("testEvent", function (data) { console.log("callback" + data); console.log("top", JSON.parse(data).top); console.log("left", JSON.parse(data).left); }); }
  5. 在需要移动的dom元素上添加data-drag属性,如: data-drag="box" data-range='parent' data-drag="box" data-range='screen' data-direction="vertical" data-drag="box" data-range='dom的id值'

其他框架以及原生开发参考vue

属性和事件

  1. 属性 data-drag-------设置元素可以移动--必填---box(固定) data-range------元素移动范围------选填---parent(移动范围为父元素)/screen(移动范围为浏览器可视区域)(不填默认为此值) --------------------------------------- 移动范围元素的id data-direction--元素移动方向------选填---vertical(垂直移动)/landscape(横向移动)/all(不填默认为此值)

  2. 事件 testEvent------鼠标提起或者手指松开时触发--参数data是个对象,包含属性如下:
    -----------------------------------------domId: 当前移动元素的id -----------------------------------------domClass:当前移动元素的class -----------------------------------------top: 当前移动元素距离起始点向下移动的距离(负值时说明是向上移动) -----------------------------------------left: 当前移动元素距离起始点向右移动的距离(负值时说明是向左移动)