Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've made some modification to the answer given by Sinan Yasar. It's not perfect but it already behave much more like I would except.</p> <p>One main addition is a click listener that calls the select.</p> <pre><code>// manually trigger the "select" of clicked elements $( "#selectable &gt; div" ).click( function(e){ if (e.metaKey == false) { // if command key is pressed don't deselect existing elements $( "#selectable &gt; div" ).removeClass("ui-selected"); $(this).addClass("ui-selecting"); } else { if ($(this).hasClass("ui-selected")) { // remove selected class from element if already selected $(this).removeClass("ui-selected"); } else { // add selecting class if not $(this).addClass("ui-selecting"); } } $( "#selectable" ).data("selectable")._mouseStop(null); }); </code></pre> <p>You can see a complete working example here: <a href="http://jsfiddle.net/DXrNn/4/" rel="nofollow noreferrer">http://jsfiddle.net/DXrNn/4/</a></p> <p>There is also a jquery-ui plugin available that does just that: <a href="http://code.google.com/p/jqdragdropmultiselect/" rel="nofollow noreferrer">http://code.google.com/p/jqdragdropmultiselect/</a> The probleme is that it doesn't look maintained.</p> <p>edit: if you define the "filter" option of the draggable, you will need to call selectable.refresh() before the selectable._mouseStop(null).</p> <pre><code>$( "#selectable &gt; div" ).click( function(e){ ... var selectable = $("#container").data("selectable"); selectable.refresh(); selectable._mouseStop(null); ... </code></pre>
    singulars
    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. 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