can not apply mouse cursor changes when dragging
backinfile opened this issue · comments
backinfile commented
can not apply mouse cursor changes when dragging.
code:
var dom = $('<div>')
.css('border', '2px red solid')
.css('width',100)
.css('height',100)
.css('position', 'fixed')
.css('cursor', 'grab')
.css('z-index',40000)
.appendTo(document.body);
var drag = dom.draggabilly();
drag.on('dragStart', function(){dom.css('cursor', 'grabbing')});
drag.on('dragEnd', function(){dom.css('cursor', 'grab')});
David DeSandro commented
The most straightforward way to add grab/grabbing cursor CSS is by using Draggabilly's built-in classes
.draggable {
cursor: -webkit-grab;
cursor: grab;
}
.draggable.is-pointer-down {
cursor: -webkit-grabbing;
cursor: grabbing;
}
See demo https://codepen.io/desandro/pen/938d281feb728de9fad9ee5e8d555d18