All Projects → catc → Displace

catc / Displace

Licence: mit
Minimal javascript library for creating movable DOM elements

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Displace

Phototweaks
Drag, Rotate, Scale and Crop
Stars: ✭ 1,214 (+855.91%)
Mutual labels:  drag
Html5sortable
VanillaJS sortable lists and grids using native HTML5 drag and drop API.
Stars: ✭ 1,384 (+989.76%)
Mutual labels:  drag
Blazor.diagrams
A fully customizable and extensible all-purpose diagrams library for Blazor
Stars: ✭ 119 (-6.3%)
Mutual labels:  drag
V Dragged
Vue directive plugin for drag event detection.
Stars: ✭ 84 (-33.86%)
Mutual labels:  drag
Cardsstack
An awesome set of cards at your disposal ✌️ ⚡️
Stars: ✭ 97 (-23.62%)
Mutual labels:  drag
Zhpopupcontroller
Help you pop up custom views easily. and support pop-up animation, layout position, mask effect and gesture interaction etc.
Stars: ✭ 1,481 (+1066.14%)
Mutual labels:  drag
Example Datasets
Demo Data for ArangoDB
Stars: ✭ 68 (-46.46%)
Mutual labels:  move
Fullrecyclerview
This is a compilation of different kinds and actions in recyclerView
Stars: ✭ 127 (+0%)
Mutual labels:  drag
Vue Drag Tree
基于Vue的拖拽组织树
Stars: ✭ 98 (-22.83%)
Mutual labels:  drag
Chartjs Plugin Dragdata
Draggable data points plugin for Chart.js
Stars: ✭ 116 (-8.66%)
Mutual labels:  drag
Ninaselectionview
Way to select your buttons.
Stars: ✭ 87 (-31.5%)
Mutual labels:  drag
Fs extra
Expanding opportunities standard library std::fs and std::io
Stars: ✭ 95 (-25.2%)
Mutual labels:  move
React Smooth Dnd
react wrapper components for smooth-dnd
Stars: ✭ 1,560 (+1128.35%)
Mutual labels:  drag
Android
Android projects with reusable components which will be useful in your applications.
Stars: ✭ 81 (-36.22%)
Mutual labels:  drag
Snap.svg.zpd
A zoom/pan/drag/rotate plugin for Snap.svg (useful for view only)
Stars: ✭ 119 (-6.3%)
Mutual labels:  drag
Leaflet.motion
A simple tool to animate polylines and polygons in different way
Stars: ✭ 76 (-40.16%)
Mutual labels:  move
The Drag And Drop Component Suite For Delphi
Stars: ✭ 109 (-14.17%)
Mutual labels:  drag
Dnd Kit
A modern, lightweight, performant, accessible and extensible drag & drop toolkit for React.
Stars: ✭ 3,456 (+2621.26%)
Mutual labels:  drag
React File Drop
React component for Gmail or Facebook -like drag and drop file uploader
Stars: ✭ 123 (-3.15%)
Mutual labels:  drag
Gong Wpf Dragdrop
The GongSolutions.WPF.DragDrop library is a drag'n'drop framework for WPF
Stars: ✭ 1,669 (+1214.17%)
Mutual labels:  drag

displace.js

A minimal javascript library to enable moveable DOM elements.

  • ~1.2kb gzipped
  • supports mobile touch
  • no dependencies/bloat
  • IE9+

Getting started

Reference

Install via npm:

npm install --save displacejs

Reference displace.min.js and use via displace:

// es6
import displace from 'displacejs';

// commonjs
let displace = require('displace');

// if using globally in browser
const displace = window.displacejs;

Initialize

Initialize and use:

// initial
const d = displace(document.querySelector('.some-div'), options);

API

Methods

displace(element, options)

Creates a new displace instance with a DOM element. For options, see below.

reinit()

Runs setup again. Useful when divs have been moved or resized.

displace.destroy()

Removes event listeners and destroys instance.


Options

constrain

Constrains element to its parent container

Default: false

relativeTo

Constrains element to the specified DOM element. Requires constrain to be true.

Default: null

handle

Assigns a child element as the moveable handle for the parent element.

Default: null

highlightInputs

Allows you to highlight text in inputs and textareas by disabling drag events originating from those elements.

Default: false

ignoreFn

Function that allows you to prevent dragging from an event. If the function returns true, the event will be ignored.

Default: null

onMouseDown

Function that is triggered when user clicks down on moveable element.

Default: null

onMouseMove

Function that is triggered when user moves element.

Default: null

onMouseUp

Function that is triggered when user clicks up on moveable element.

Default: null

onTouchStart

Function that is triggered when initiates touch event.

Default: null

onTouchMove

Function that is triggered when moves element during touch event.

Default: null

onTouchStop

Function that is triggered when user ends touch event.

Default: null

customMove

Function that can be used to override how x and y are being set on the displaced element on move.

Default: null

Development

Clone the repo and npm install. Available npm scripts are:

  • build library: lib-build
  • library development (watch src files and build on change): lib-dev
  • docs development (port 3001): docs-dev
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].