Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Sortable (Drag-n-Drop) Dashboard Containers
    text
    copied!<p><strong><h1>Scenario:</h1></strong></p> <p>I'm trying to create a dashboard of sorts which will have widgets of varying sizes. I would like the user to be able to arrange their widgets to their liking.</p> <p>I have been trying to implement jQuery UI's <strong>sortable</strong> interaction, using the <strong><a href="http://jqueryui.com/sortable/#portlets" rel="nofollow noreferrer">portlets</a></strong> example, but I'm having some trouble.</p> <p><img src="https://i.imgur.com/JlTWVkw.png" alt="enter image description here"></p> <p><strong><h1>What's Working:</h1></strong></p> <p>I can drag and drop/rearrange containers between columns within the same row.</p> <p><strong><h1>What's NOT Working:</h1></strong> I cannot drag containers between rows.</p> <p><strong><h1>My Question:</h1></strong> How can I enable dragging/dropping between rows <em>and</em> columns?</p> <p><strong><h1>jsFiddle Demo:</h1></strong> <a href="http://jsfiddle.net/SWUTR/" rel="nofollow noreferrer">http://jsfiddle.net/SWUTR/</a></p> <hr> <p><strong>Relevant HTML:</strong></p> <pre><code>&lt;div class="column"&gt; &lt;div class="container span2"&gt;&lt;/div&gt; &lt;div class="container span2"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="column"&gt; &lt;div class="container span1"&gt;&lt;/div&gt; &lt;div class="container span2"&gt;&lt;/div&gt; &lt;div class="container span1"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="column"&gt; &lt;div class="container span4"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p><strong>Relevant CSS:</strong></p> <pre><code>.column .container { float:left; margin:5px; min-width:100px; height:250px; background:#39F; } .column .container.span1 { width:calc(25% - 10px); background:#6CC; } .column .container.span2 { width:calc(50% - 10px); background:#6F6; } .column .container.span3 { width:calc(75% - 10px); background:#99C; } .column .container.span4 { width:calc(100% - 10px); background:#33C; } </code></pre> <p><strong>Relevant jQuery:</strong></p> <pre><code>$(".column").sortable({ connectWith: ".column" }); $(".column").disableSelection(); </code></pre>
 

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