我有以下可拖动的列表项结构:
<ul id="dadCol_0" class="dad-list ui-sortable">
<li class="dad-item ui-draggable" id="sl1" style="position: relative;">1</li>
<li class="dad-item ui-draggable" id="sl2" style="position: relative;">2</li>
<li class="dad-item ui-draggable" id="sl3" style="position: relative;">3</li>
<li class="dad-item ui-draggable" id="sl4" style="position: relative;">4</li>
<li class="dad-item ui-draggable" id="sl5" style="position: relative;">5</li>
</ul>
jQuery:
dad_list.sortable({
connectWith: 'ul.dad-list',
containment: '#containment',
items: 'li.dad-item',
cursorAt: {
top: Math.round($(this).outerHeight() / 2)
},
stop: function(event, ui) {
serializedads();
}
});
这一切都可以,但看起来 .outerHeight() 为 0,拖动的项目卡在顶部。我需要高度/ 2 位置。