https://codepen.io/hobbeschild/pen/wBMoqLL
Я могу найти множество ответов, объясняющих, как изменить курсор при перетаскивании, но это постоянные решения CSS, а не динамические в зависимости от события onMove.
Код: Выделить всё
// List with handle
Sortable.create(listWithHandle, {
handle: '.glyphicon-move',
animation: 150,
filter: ".disabled",
onMove: function(evt) {
if (evt.related.className.indexOf('disabled') === -1) {
return true;
}
evt.dragged.classList.add('no-drop');
return false;
}
});Код: Выделить всё
body {
padding: 10px;
}
.glyphicon-move {
cursor: move;
cursor: -webkit-grabbing;
}
.no-drop {
cursor: not-allowed !important;
}Код: Выделить всё
14
Drag me by the handle
2
You can also select text
1
Best of both worlds!
Подробнее здесь: https://stackoverflow.com/questions/797 ... urns-false
Мобильная версия