Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you want to use <code>.droppable()</code>, <code>.draggable()</code>, &amp; <code>.sortable()</code>, then you only need to use <code>.sortable()</code>. </p> <p>Using your jsfiddle, I made the following changes:</p> <p>HTML:</p> <pre><code>&lt;div id="wrapper"&gt; &lt;div id="origin" class="fbox"&gt; &lt;ul id="sort1" class="list"&gt; &lt;li&gt;&lt;img src="http://placehold.it/140x100" id="one" title="one" class="draggable" /&gt;&lt;/li&gt; &lt;li&gt;&lt;img src="http://placehold.it/140x100" id="two" title="two" class="draggable" /&gt;&lt;/li&gt; &lt;li&gt;&lt;img src="http://placehold.it/140x100" id="three" title="three" class="draggable" /&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;p&gt;test&lt;/p&gt; &lt;div id="drop" class="fbox"&gt; &lt;ul id="sort2" class="list"&gt;&lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>JAVASCRIPT:</p> <pre><code>$( "#sort1, #sort2" ).sortable({ helper:"clone", opacity:0.5, cursor:"crosshair", connectWith: ".list", receive: function( event, ui ){ //this will prevent move than 3 items in droppable list if($(ui.sender).attr('id')==='sort1' &amp;&amp; $('#sort2').children('li').length&gt;3){ $(ui.sender).sortable('cancel'); } } }); $( "#sort1,#sort2" ).disableSelection(); </code></pre> <p>CSS:</p> <pre><code>#origin { background-color: green; } #drop { background-color: red; min-height: 120px; } .list { min-height: 120px; } .list li { display: inline-block; list-style-type: none; padding-right: 20px; } </code></pre> <p>DEMO: <a href="http://jsfiddle.net/39khs/80/">http://jsfiddle.net/39khs/80/</a></p> <p>Hope this helps and let me know if you have any questions!</p> <p><hr/> Links:</p> <ul> <li><a href="http://api.jqueryui.com/sortable/">http://api.jqueryui.com/sortable/</a></li> </ul>
    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. This table or related slice is empty.
    1. 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