Giter Site home page Giter Site logo

linecode / jquery.drag-multiple Goto Github PK

View Code? Open in Web Editor NEW

This project forked from javadoug/jquery.drag-multiple

0.0 2.0 0.0 223 KB

A jQueryUI plugin enabling the selection, drag and drop of multiple ui-draggable elements.

License: MIT License

JavaScript 97.30% HTML 2.70%

jquery.drag-multiple's Introduction

Drag Multiple Plugin

A jQueryUI plugin enabling the selection, drag and drop of multiple ui-draggable elements.

Getting Started

Download the production version or the development version.

In your web page:

<script src="jquery.js"></script>
<script src="jquery-ui.js"></script>
<script src="dist/jquery-ui.drag-multiple.min.js"></script>
<script>
jQuery(function($) {
  $('div').draggable({multiple: true});
});
</script>

Then add .ui-selected class to .ui-draggable elements to drag them as a group.

Documentation

Options

You can pass the following parameters within the multiple option hash object:

multiple.items

Specify the selection of elements to move. The default selection is $(".ui-draggable.ui-selected").

multiple.items = function getSelectedItems() {
    return $(".ui-draggable.ui-selected");
};

multiple.beforeStart

Cancel drag multiple and other setup work you might need. The default implementation is shown here.

multiple.beforeStart = function beforeDragStart(jqEvent, ui) {
    // make sure target is selected, otherwise deselect others
    if (!(this.is('.ui-draggable') && this.is('.ui-selected'))) {
        $(".ui-draggable").removeClass('ui-selected');
        return false;
    }
};

multiple.beforeDrag

Called on before each draggable.drag event. The default is $.noop.

multiple.beforeDrag = function beforeDrag(jqEvent, ui) {
    
};

multiple.beforeStop

Called before draggable.stop event. The default is $.noop.

multiple.beforeStop = function beforeDragStop(jqEvent, ui) {
    
};

multiple.stack

Just like jQueryUI Draggable's stack option, but for multiple elements; all selected elements move to the top of the stack when one of them is dragged. The default is false.

Examples

(Coming soon)

Release History

0.1.0 inital release

0.1.1 fix

0.1.2 fix

jquery.drag-multiple's People

Contributors

javadoug avatar markmatney avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.