Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There's nothing wrong with the code... except that it was invalid. You had a incorrectly closed tag, and other oddities inside the code that once cleaned up resolved the problem. I think. Unless it isn't what you was asking about.</p> <p>HTML: </p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Untitled Document&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;ul id="k1" style="width:350px; height:350px; margin:20px;"&gt; &lt;li&gt;One&lt;/li&gt; &lt;li&gt;Two&lt;/li&gt; &lt;li&gt;Three&lt;/li&gt; &lt;/ul&gt; &lt;hr /&gt; &lt;ul style="width:350px; height:350px;"&gt; &lt;li class="gt"&gt;Four&lt;/li&gt; &lt;/ul&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>CSS: </p> <pre><code>body { font-size: 12px; } li{ border:1px solid #444444; background-color:#AAAAAA; padding:10px; margin:10px; } </code></pre> <p>jQuery:</p> <pre><code>$("#k1").sortable({ revert: '100' }); $('.gt').draggable({ connectToSortable: '#k1', revert: 'invalid', revertDuration: 100 }); </code></pre> <p><strong>Edit</strong>: Sorry, I misread the question. The code was slightly confusing, and I missed the problem. The solution is a little bit of a kludge, but I think it will work. </p> <pre><code>var original = $('#k1'); original.sortable({ revert: 100 }); $('.gt').draggable({ connectToSortable: original, revert: 'valid', revertDuration: 100, stop: function(event, ui) { original.sortable("option", "revert", 100); } }); </code></pre> <p>Basically it re-set the revert option on the <code>k1</code> div after <code>.gt</code> is dropped.</p>
 

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