Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't have this working using sortable, but I did using draggable &amp; droppable. I don't know if I covered all the functionality you need, but it should be a good start (<a href="http://jsfiddle.net/T68Fn/" rel="noreferrer">demo here</a>):</p> <p>HTML</p> <pre><code>&lt;div class="demo"&gt; &lt;p&gt;Available Boxes (click to select multiple boxes)&lt;/p&gt; &lt;ul id="draggable"&gt; &lt;li&gt;Box #1&lt;/li&gt; &lt;li&gt;Box #2&lt;/li&gt; &lt;li&gt;Box #3&lt;/li&gt; &lt;li&gt;Box #4&lt;/li&gt; &lt;/ul&gt; &lt;p&gt;My Boxes&lt;/p&gt; &lt;ul id="droppable"&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>Script</p> <pre><code>$(document).ready(function(){ var selectedClass = 'ui-state-highlight', clickDelay = 600, // click time (milliseconds) lastClick, diffClick; // timestamps $("#draggable li") // Script to deferentiate a click from a mousedown for drag event .bind('mousedown mouseup', function(e){ if (e.type=="mousedown") { lastClick = e.timeStamp; // get mousedown time } else { diffClick = e.timeStamp - lastClick; if ( diffClick &lt; clickDelay ) { // add selected class to group draggable objects $(this).toggleClass(selectedClass); } } }) .draggable({ revertDuration: 10, // grouped items animate separately, so leave this number low containment: '.demo', start: function(e, ui) { ui.helper.addClass(selectedClass); }, stop: function(e, ui) { // reset group positions $('.' + selectedClass).css({ top:0, left:0 }); }, drag: function(e, ui) { // set selected group position to main dragged object // this works because the position is relative to the starting position $('.' + selectedClass).css({ top : ui.position.top, left: ui.position.left }); } }); $("#droppable, #draggable") .sortable() .droppable({ drop: function(e, ui) { $('.' + selectedClass) .appendTo($(this)) .add(ui.draggable) // ui.draggable is appended by the script, so add it after .removeClass(selectedClass) .css({ top:0, left:0 }); } }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload