• This repository has been archived on 15/Dec/2020
  • Stars
    star
    172
  • Rank 221,201 (Top 5 %)
  • Language
    JavaScript
  • License
    Other
  • Created over 13 years ago
  • Updated about 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A JavaScript micro-framework for adding drag-and-drop functionality to elements for advanced UI development

DragDrop

A JavaScript micro-framework for adding drag-and-drop functionality to elements for advanced UI development

Author: James Brumond
Version: 0.2.3-beta

Copyright 2011 James Brumond
Dual licensed under MIT and GPL

Notice

The change to version 0.2.1-beta is NOT backwards compatible. Make sure to look over the samples below.

Features

  • Simple and intuitive interface
  • Option to seperate the event target from the dragged element
  • Bindable dragstart/drag/dragend events
  • Option to define bounding boxes (new in version 0.2.1-beta)
  • Very lightweight (only 1.8kb minified and gzipped)

Samples! :)

// Make myElement drag-and-drop enabled
DragDrop.bind(myElement);

// A more complex version
var draggable = DragDrop.bind(myElement, {
    // The anchor; myElement moves when anotherElement is dragged
    anchor: anotherElement,
    // The draggable element will now stay bound within it's offsetParent
    boundingBox: 'offsetParent',
    // Define a dragstart event
    dragstart: function(evt) {
        // ...
    }
});

// Change the bounding box to some manual positions
draggable.setBoundingBox({
    x: { min: 0, max: 600 },
    y: { min: 0, max: 400 }
});

// Define a new dragend event
draggable.bindEvent('dragend', function(evt) {
    // ...
});

// This is how you would remove a drag event (if one were defined above)
draggable.unbindEvent('drag', theBoundDragEventFunction);

More Repositories

1

Git.php

A PHP git library
PHP
768
star
2

Events.js

A JavaScript micro-framework for events
JavaScript
141
star
3

node-cards

A Node.js playing card module with support for custom decks
TypeScript
87
star
4

polyfill.js

A node.js application that serves the polyfill.js client framework
JavaScript
80
star
5

UglifyJS.php

A PHP port of the UglifyJS JavaScript obfuscator
JavaScript
47
star
6

node-trie

A trie dictionary storage model for Node.js
JavaScript
15
star
7

Box.js

A cross-browser storage library using localStorage and others
JavaScript
13
star
8

node-eventstream

A server-side companion for EventSource
JavaScript
12
star
9

snes-wasm

An experimental SNES emulator written in AssemblyScript (web assembly)
TypeScript
10
star
10

class.js

A simple JavaScript class system
JavaScript
10
star
11

ExtID

OpenID and OAuth together in one easy-to-use external ID library
PHP
6
star
12

funimationnow

TypeScript library for interacting with FunimationNow service APIs
TypeScript
6
star
13

node-sechash

Secure password hashing with salt and key stretching for Node.js
JavaScript
5
star
14

terminus-scrollbar

A Terminus plugin for adding a scrollbar to the terminal pane
TypeScript
5
star
15

terminus-title-control

A Terminus plugin for modifying the title bar/tab text
TypeScript
5
star
16

cards.js

A JavaScript Playing Card Library
JavaScript
4
star
17

Default

A jQuery plugin that sets the default "value" for a text input.
JavaScript
4
star
18

mee.js

A mouse event emulator for touch devices
JavaScript
3
star
19

ws-gui

WIP Electron client app for interacting with WebSocket APIs
JavaScript
2
star
20

node-rand-utils

Node.js Randomization Utilities
JavaScript
2
star
21

nss

A CLI utility for easily creating a (mostly) static node.js server on the fly
Python
2
star
22

node-builder

A JS/CSS Build Utility
JavaScript
2
star
23

noita-recipes

TypeScript code for generating LC and AP recipes for the game Noita
TypeScript
1
star