moving

A tiny library to make html node movable.

Usage no npm install needed!

<script type="module">
  import moving from 'https://cdn.skypack.dev/moving';
</script>

README

moving

A tiny library to make html node movable.

Compatibility: >= IE9. (Because of using transform style).

Demo is here.

Usage.

Common.js:

const moving = require('moving')

const myDiv = document.querySelector('#my-div')

moving.setDraggable(myDiv)  // Now it can move to anywhere.
moving.setUndraggable(myDiv)  // Stay here forever.

Use it directly:

<script src="node_modules/moving/src/index.js"></script>
<script>
  const myDiv = document.querySelector('#my-div')

  moving.setDraggable(myDiv)  // Now it can move to anywhere.
  moving.setUndraggable(myDiv)  // Stay here forever.
</script>

License

MIT.