CSS Drag and Drop Module Demo

The CSS Drag and Drop Module automatically configures screen reader and keyboard accessible drag and drop functionality using standard DOM elements.
Module files:

  1. css_drag_drop_module.js : Automatically morphs standard DOM elements into draggable AccDC Objects accessible to screen reader and keyboard only users using an object literal declaration to configure.
  2. setup.js : The object literal declaration and bindings that configure the demo functionality.

The packaged file for this demo can be downloaded from WhatSock.com under Downloads.

CSS Drag and Drop Demo

Bookshelf

  • A Short History of Nearly Everything by Bill Bryson
  • Fierce Invalids Home From Hot Climates by Tom Robbins
  • Neuromancer by William Gibson
  • Swords and Deviltry by Fritz Leiber
  • The Magicians by Lev Grossman
  • The Face in the Frost by John Bellairs
  • The Last Unicorn by Peter S. Beagle
  • Snow Crash by Neal Stevenson
  • Altered Carbon by Richard K. Morgan
  • Empire of the East by Fred Saberhagen
  • Hyperion by Dan Simmons
  • The Forever War by Joe Haldeman

Reading List

    Instructions:

    The CSS Drag and Drop Module automatically synchronizes mouse and keyboard activity for drag and drop functionality.

    Coding Syntax

    // Object literal declaration to configure drag and drop functionality
    config = {

    // Specify draggable objects
    setDrag: 'CSS Selector',

    // Specify the drop zone
    setDrop: 'CSS Selector',

    // Return the string value for every draggable node matching "setDrag" to use as the drag and drop link text
    setName: function(obj){
    return obj.STRING;
    },

    // Set the initial styles for the morphed AccDC Object
    cssObj: {
    property: 'value'
    },

    // Run script before the AccDC Object opens
    runBefore: function(dc){
    // Do something
    },

    // Run script after the AccDC Object opens
    runAfter: function(dc){
    // Do something
    },

    // Configure drag and drop event handlers
    on: {
    dragStart: function(ev, dd, dc){
    // Do something
    },
    drag: function(ev, dd, dc){
    // Do something
    },
    dropStart: function(ev, dd, dc){
    // Do something
    },
    drop: function(ev, dd, dc){
    // Do something
    },
    dropEnd: function(ev, dd, dc){
    // Do something
    },
    dragEnd: function(ev, dd, dc){
    // Do something
    }
    },

    // Restrict draggability within a specific container
    confineTo: 'CSS Selector',

    // Set the drop animation time length in milliseconds for keyboard users
    duration: 2000,

    // Optionally set a custom insertion point where drop links will be inserted into the DOM
    dropAnchor: 'CSS Selector',

    // Set additional styling for the hidden drag and drop links
    ddCSS: {
    property: 'value'
    },

    // Optionally set a root node for tunneling
    root: document

    };

    // Morph all specified DOM nodes into draggable AccDC Objects
    setDragAndDrop(config);