views:

361

answers:

2

my application have many drag and drop features. and while dragging i want that cursor changes to some grab.cur. ie and firefox are working fine in this. but in chrome it always changes the cursor to text cursor. I m stuck badly please help.

+2  A: 

I have a similar issue using jQuery UI draggable and sortable (ver. 1.8.1), and it's quite specific, so I assume that you are using same library.

Problem is caused by a bug in jQuery UI (actually a fix for other Safari bug). I just raised the issue in jQuery UI http://dev.jqueryui.com/ticket/5678 so I guess you will need to wait till it's fixed.

I've found a workaround for this, but it's quite hard-core, so you only use it if you really know what is going on ;)

if ($.browser.safari) {
    $.ui.mouse.prototype.__mouseDown = $.ui.mouse.prototype._mouseDown;
    $.ui.mouse.prototype._mouseDown = function(event){
        event.preventDefault();
        return $.ui.mouse.prototype.__mouseDown.apply(this, arguments);
    }
}

It simply switches off the fix that's in jQuery UI code, so basically it may break something.

bartaz
Hi, Thanx for your reply but I m not using any javascript library. So it cant help me :(
+3  A: 

Try turning off text selection event.

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

This will disable any text selection on the page and it seems that browser starts to show custom cursors.

But remember that text selection will not work at all, so it's the best to do it only while dragging, and turn it on again just after that. Just attach function that doesn't return false:

document.onselectstart = function(){ return true; }
bartaz
Hey man thanx for you reply but I tried this also. but it didnt work for me. :(