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

simple-sortable

v1.0.4

Published

a component to sort item.

Downloads

3

Readme

Simple Sortable

一个简单的排序组件,用来替代D&D API。

依赖项:

使用方法

首先,需要在页面里引用相关脚本以及css

<script type="text/javascript" src="path/to/jquery.min.js"></script>
<script type="text/javascript" src="path/to/module.js"></script>
<script type="text/javascript" src="path/to/dragdrop.js"></script>
<script type="text/javascript" src="path/to/sortable.js"></script>

通过sortable方法,实例化sortable对象

simple.dragdrop({
    wrapper: '.wrapper',
    items: '.ball'
});

API 文档

####初始化选项

wrapper

必选,需要排序的元素的容器元素。

items

必选,需要排序的元素的selector string

helper

可选,拖拽的helper元素,可以是Dom/function,如果为空则为原元素。

placeholder

可选,开始拖动之后被拖拽元素会隐藏,显示placeholder,可以是Dom/function,如果为空,则是一个空白的占位元素

cursorPosition

可选,确定helper的相对于鼠标的位置,默认为'auto',还可以为'center'(中心), 'cornor'(左上角)

cursorOffset

可选,对helper位置进行微调,需要传入top以及left

axis

可选,拖拽的方向,默认为空, 可以为'x', 'y'

distance

可选,拖动触发的距离

方法

destroy()

销毁sortable对象,还原初始环境

事件

sortstart opts: placeholder, helper, item

排序开始时触发

sortend opts: item

排序结束时触发