更新时间:2022-11-02 14:40:35
$('< some element here>' ).on('dragstart',function(){
$(this).css(cursor,move);
});
但是,这将永久地更改元素上的光标,以切换此光标更改添加
$('< some element here>')on('dragend',function(){
$ ).css(cursor,default); //或任何要还原到
}的指针);
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?
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
});