Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery shuffle plugin breaks jQuery-UI sortables
    primarykey
    data
    text
    <p>I have a problem with a jQuery shuffle plugin I found. It breaks my nested sortable lists. At the bottom I put a link to a demo showing the problem, which is described below.</p> <p>The html is simple, there is an ordered list containing four list items. Each of these list items contains an unordered list with two list items. And there is a button at the bottom to shuffle the ordered list. </p> <pre><code> &lt;ol&gt; &lt;li&gt; &lt;ul&gt; &lt;li&gt;Item A&lt;/li&gt; &lt;li&gt;Item B&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; &lt;ul&gt; &lt;li&gt;Item C&lt;/li&gt; &lt;li&gt;Item D&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; &lt;ul&gt; &lt;li&gt;Item E&lt;/li&gt; &lt;li&gt;Item F&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt; &lt;ul&gt; &lt;li&gt;Item G&lt;/li&gt; &lt;li&gt;Item H&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ol&gt; &lt;button type="button" class="shuffle"&gt;Shuffle&lt;/button&gt; </code></pre> <p>The ordered lists is sortable, and also the unordered lists are sortable and connected (e.g. I can move "Item A" below "Item G"). So far, so good!</p> <pre><code>$(document).ready(function () { $('ol').sortable({ placeholder: 'dashed' }); $('ul').sortable({ placeholder: 'dashed', connectWith: 'ul' }); $('.shuffle').button().click(function(){ $('ol').shuffle(); }); }); </code></pre> <p>The shuffle button (almost) does what I expect it to do, it shuffles the ordered list (not the unordered!). But as it does that, it also breaks the unordered sortable lists. No longer am I able to move the elements around as it worked before I shuffled.</p> <p>Am I doing something wrong? Is there a bug in the plugin?</p> <p>Link to the plugin: <a href="http://yelotofu.com/labs/jquery/snippets/shuffle/jquery.shuffle.js" rel="nofollow">http://yelotofu.com/labs/jquery/snippets/shuffle/jquery.shuffle.js</a></p> <p>Link to a demo of the problem: <a href="http://jsbin.com/umeju6" rel="nofollow">http://jsbin.com/umeju6</a></p>
    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.
 

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