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

drag-js

v0.0.2

Published

A really cute dragger addone for Blyde

Downloads

9

Readme

Drag.js

Demo

A really cute dragger addone for Blyde, inspired by the dragging effect of FL Studio

Smooth even on MTK devices

demo


Notice

Blyde DOES NOT compatible with jQuery!!

Maybe Drag.js is a little bit difficult to use, but it worth it!

Installation

git clone https://github.com/classicoldsong/Drag.js.git

or

npm install drag-js

Usage

First you need to include these scripts before document is loaded:

<script src="blyde.min.js"></script>
<script src="drag.min.js"></script>

Then you can drag ANY element on your page using element.stargDrag()!

API

  • element.startDrag(width, height): Start drag this element with specified width and height in string such as element.startDrag('124px', '50px'). You can also stard drag directly without these parameters.
  • element.dragRelease(callback): Release the drag with or without callback and the animation will continue until the element moves to it's target coordinate. Callback will be fired as soon as the animation finishes.
  • element.stopDrag(callback): Stops dragging immediately, if without callback the element will be returned to it's original place. Callback will be fired before the dragHolder and dragCase being removed from the document.
  • element.moveTo(x, y, callback): Move the element to a specified coordinate with animation. If callback exists, it will be fired as soon as the animation finishes, and the element.stopDrag() is NOT automatically excuted.

After element.startDrag(), you can get these:

  • element.dragCase: The container of the element when dragging.
  • element.dragHolder: The placeholder for the original element.
  • element.dragCase.dragger.posX: Current X coordinate.
  • element.dragCase.dragger.posY: Current Y coordinate.
  • element.dragCase.dragger.deg: Current rotation degree.

After element.dragRelease() you can get these:

  • element.dragCase.dragger.targetX: The destination X coordinate, by default it is the X position where your mouse is when element.dragRelease() is excuted.
  • element.dragCase.dragger.targetY: The destination Y coordinate, by default it is the Y position where your mouse is when element.dragRelease() is excuted.

You can set the target position manually after element.dragRelease() is excuted, but obviously using element.moveTo(x, y) is a better idea.

Not understanding?

Don't worry, just read the source code of demo.js to look for some inspiration. You can make it!

License

MIT, © ClassicOldSong