当beforeStop singal触发ui.item
等于ui.helper
时,即该项目已被帮助者替换,我无法访问发起事件的可拖动事件。
这是JavaScript
makeDraggable = function(ID) {
$('ul#elements > li.element').each(function() {
$(this).draggable({
helper: function() {
return $('<div style="height: 100px; width: 300px; background: #F9FAFA; box-shadow: 5px 5px 1px rgba(0,0,0,0.1); text-align: center; line-height: 100px; font-size: 28px; color: #16A085"><span class="fui-list"></span></div>');
},
revert: 'invalid',
appendTo: 'body',
connectToSortable: ID,
});
});
};
makeSortable = function(el) {
el.sortable({
revert: true,
placeholder: 'drop-hover',
beforeStop: function(event, ui) {
console.log(ui.item);
console.log(ui.helper);
},
});
};
makeDraggable('#page1');
makeSortable($('#page1'));
这是可拖动的:
<li class="element element_0 ui-draggable ui-draggable-handle" style="display: list-item;">
<img src="http://localhost:8000/images/thumbs/header10.png" data-src="http://localhost:8000/elements/header10.html" data-height="567" alt="Site Block">
</li>
我做错了什么?