Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well I was messing with it for a while.. The following if the best I could come up with in that time..</p> <pre><code>var selected; var selectedCurrent; var temp; var received = false; $("ul").on('mousedown', 'li', function (e) { if($(this).next('li').hasClass('pholder')) $(this).next('li').remove(); if ((e.ctrlKey || e.metaKey) &amp;&amp; selected != undefined) { if($(this).text() != selectedCurrent.text()) selectedCurrent.after(selected.clone().addClass('pholder temp').hide()); } selectedCurrent = $(this); selected = $(this).clone().removeClass('selected'); }); $("ul").on('click', 'li', function (e) { if(temp != undefined) $('.temp').remove(); if (e.ctrlKey || e.metaKey) { if($(this).next('li').hasClass('pholder')) $(this).next('li').remove(); else $(this).after($(this).clone().addClass('pholder').hide()); $(this).toggleClass("selected"); } else { $(this).addClass("selected").siblings().removeClass('selected'); $('.pholder').remove(); } }).sortable({ connectWith: "ul", delay: 150, revert: 0, helper: function (e, item) { if (!item.hasClass('selected')) { item.addClass('selected').siblings().removeClass('selected'); } var elements = item.parent().children('.selected').clone(); item.data('multidrag', elements).siblings('.selected').remove(); var helper = $('&lt;li/&gt;'); return helper.append(elements); }, stop: function (e, ui) { if(!received){ selected.remove(); $('.pholder').remove(); } else{ received = false; $('.pholder').removeClass('pholder'); } var elements = ui.item.data('multidrag'); ui.item.after(elements).remove(); $('.selected').removeClass('selected'); }, start: function(event, ui){ ui.item.after(selected); $('.pholder').show(); }, receive: function(event, ui){ received = true; } }); </code></pre> <p>Fiddle</p> <p><a href="http://jsfiddle.net/hQnWG/749/" rel="nofollow">http://jsfiddle.net/hQnWG/749/</a></p> <p><strong>Update</strong></p> <p><a href="http://jsfiddle.net/hQnWG/752/" rel="nofollow">http://jsfiddle.net/hQnWG/752/</a></p> <p><strong>Update 2</strong> - Gets rid of duplicates in list.</p> <p><a href="http://jsfiddle.net/hQnWG/754/" rel="nofollow">http://jsfiddle.net/hQnWG/754/</a></p>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. 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