admin管理员组

文章数量:1303353

I am working on a web app and I need to override some of the default cursors.

In chrome when I click and then drag it ALWAYS changes the cursor to text selection. I can not seem to find any way to override this.

I am using jquery, and the usual

$(document).css('cursor','default');

Does not work.

With chrome it seems that it brings it up not on the click, but on the mouse move. So I have even attempted to do

$(document).mousemove(function(){
    $(document).css('cursor','default');
});

And that doesn't seem to work either.

I do not have this issue in firefox though.

I am working on a web app and I need to override some of the default cursors.

In chrome when I click and then drag it ALWAYS changes the cursor to text selection. I can not seem to find any way to override this.

I am using jquery, and the usual

$(document).css('cursor','default');

Does not work.

With chrome it seems that it brings it up not on the click, but on the mouse move. So I have even attempted to do

$(document).mousemove(function(){
    $(document).css('cursor','default');
});

And that doesn't seem to work either.

I do not have this issue in firefox though.

Share asked Jun 17, 2011 at 15:44 mfrancis107mfrancis107 1,4011 gold badge13 silver badges21 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

Try turning off any text selection while drag and dropping as per chrome sets cursor to text while dragging, why?.

document.onselectstart = function(){ return false; }

It displays the text cursor because you are selecting Text while dragging (although you don't want to, but try just holding the mouse button, and moving it around the screen). To disable this, I would suggest you to use something like this

You may need to change the code in the link to disable all text, not just text within tag label. To disable the text while dragging, and when you release the mouse button to undo the changes made by disabling the text.

As soon as the text selection is disabled, Chrome should have no reason to display other cursors.

Hope this helps.

EDIT: I am new to stackoverflow, and did not know a real tag would not be displayed.

本文标签: javascriptClick and Drag Cursor in ChromeStack Overflow