I have a webpage where I have items on the right which are draggable into columns on the left. Works great, except I want to set a fixed height or max-height on the items container on the right, with overflow-y:scroll applied. When I try to do this, the items drag under the target column instead of on top as it should. If I take the overflow property off the item container div, it works correctly.
Can someone point out where I'm going wrong? How can I get a scrollable draggable list?
JS Fiddle HERE to show what I mean... https://jsfiddle.net/bvxxetot/
Here is the javascript code I'm using to init the draggable/droppable areas
HTML
<div id="tmpl-view-builder-container">
<div id="tmpl-view-preview-container">
<div class="droppable">
</div>
</div>
<div id="tmpl-view-legend-container">
<h3>Available Fields</h3>
<div id="tmpl-view-legend-item-container">
<ul>
<li>Field 1</li>
<li>Field 2</li>
<li>Field 3</li>
<li>Field 4</li>
<li>Field 5</li>
<li>Field 6</li>
<li>Field 7</li>
<li>Field 8</li>
<li>Field 9</li>
<li>Field 10</li>
</ul>
</div>
</div>
</div>
CSS
.droppable { border:1px dashed #000000; width:75%; float:left; height:400px;}
#tmpl-view-legend-container {
position:absolute;
right:20px;
top:0px;
height:400px;
overflow-y:scroll;
}
#tmpl-view-legend-container ul { list-style-type:none; padding:0; }
#tmpl-view-legend-container ul li { background:#CCCCCC; margin-bottom:10px; padding:7px 10px; cursor:pointer; }
JS
$(function() {
$('.droppable').droppable({
accept:'#tmpl-view-legend-item-container li',
hoverClass: 'hovered',
drop: testDropFunction
});
$('#tmpl-view-legend-item-container li').draggable({
stack: '#tmpl-view-legend-items li',
cursor: 'move',
revert: true,
appendTo: 'body'
});
});
function testDropFunction(event, ui) {
alert('Testing!');
}
thank you!