Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery ui - cant seem to drag my draggables onto an empty sortable li

I have a list which I call #gallery in which I've defined a couple of li boxes.

e.g.

 <ul id="gallery">
   <li style="display: list-item; ui-draggable">A</li>
 </li>

and a box to drop them into ...

<div id="conditions-box" class="ui-droppable">      
    <ul class="gallery ui-helper-reset ui-sortable"></ul>    
</div>

With the following js

$('#conditions-box > ul').sortable();
$("#gallery > li").draggable({
   connectToSortable: '#conditions-box > ul',
   helper: 'clone'
});

When my conditions box list is empty as you see now I can drag the boxes in but they dont "stick" only when I place an existing li into the conditions box code does it actually work. However I dont want to have to do this. If you want a play you can see below. Any ideas ?

ref - http://jsfiddle.net/wmitchell/zCDE7/2/

like image 714
wmitchell Avatar asked Nov 15 '10 14:11

wmitchell


1 Answers

I think you need to set height for your conditions-box sortable. You can use css like:

#conditions-box {
  height: 40px;
}
like image 156
subosito Avatar answered Oct 21 '22 16:10

subosito