问题
I want to change the cursor when dragging, so I try this way:
function drag (event) {
localStorage.setItem("no", $(event.target).data("no"));
$("html").css("cursor", "move");
}
<tr draggable="true" class="memo_item move" id="memo_<?php echo $memo->memo_no?>" ondragstart="drag(event, this);" data-no="<?php echo $memo->memo_no?>"></tr>
but it doesn't work.
And I can't use JQueryUi.
How can I change cursor?
回答1:
Simply implement this kind of event setup in your code...
$('<some element here>').on('dragstart', function() {
$(this).css("cursor", "move");
});
However, this will permanently change the cursor on the element, to toggle this cursor change add
$('<some element here>').on('dragend', function() {
$(this).css("cursor", "default"); // or whatever pointer you want to revert to
});
来源:https://stackoverflow.com/questions/27811009/html5-drag-drop-change-cursor-while-dragging-dont-use-ui