Note that there are some explanatory texts on larger screens.

plurals
  1. POmerge two divs in a grid representation
    primarykey
    data
    text
    <p>I have a 4x4 grid that i have put through jquery UI to make it sortable and selectable. The next thing i would like to do is to be able to merge two of the divs that i select but i've absolutely no idea as to go about this.</p> <p>My first thoughts were to try to convert this to a table and toy around with colspan and rowspan attributes but this would mess up my sortable function.</p> <p>If someone could point me in the right direction i would be very grateful. Basically i may reorder cells but then make a selection of two or more cells and merge them if that makes sense!</p> <p>i have a JSFiddle of what i have so far <a href="http://jsfiddle.net/fmusV/" rel="nofollow">here</a></p> <pre><code>&lt;ol id="selectable"&gt; &lt;li class="ui-state-default" id="1"&gt;1&lt;/li&gt; &lt;li class="ui-state-default" id="2"&gt;2&lt;/li&gt; &lt;li class="ui-state-default" id="3"&gt;3&lt;/li&gt; &lt;li class="ui-state-default" id="4"&gt;4&lt;/li&gt; &lt;li class="ui-state-default" id="5"&gt;5&lt;/li&gt; &lt;li class="ui-state-default" id="6"&gt;6&lt;/li&gt; &lt;li class="ui-state-default" id="7"&gt;7&lt;/li&gt; &lt;li class="ui-state-default" id="8"&gt;8&lt;/li&gt; &lt;li class="ui-state-default" id="9"&gt;9&lt;/li&gt; &lt;li class="ui-state-default" id="10"&gt;10&lt;/li&gt; &lt;li class="ui-state-default" id="11"&gt;11&lt;/li&gt; &lt;li class="ui-state-default" id"12"&gt;12&lt;/li&gt; &lt;/ol&gt; $(function() { $( "#selectable" ) .sortable({ handle: ".handle" }) .selectable() .find( "li" ) .addClass( "ui-corner-all" ) .prepend( "&lt;div class='handle'&gt;&lt;span class='ui-icon ui-icon-arrow-4'&gt;&lt;/span&gt;&lt;/div&gt;" ); }); $(function() { $( "#selectable" ).selectable({ stop: function() { var result = $( "#select-result" ).empty(); $( ".ui-selected", this ).each(function() { var index = $( "#selectable li" ).index( this ); result.append(" #"+ ( index + 1 ) ); }); } }); }); </code></pre> <p>thanks in advance!!</p> <p><strong>EDIT</strong></p> <p>Just to also clarify, i dont mind if at this stage a blank div is created following the merge in case that s easier :)</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.
    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