3

How to change cursor when dragging using only CSS?

div:active{
    cursor:move;
}

This won't work because it will be automatically changed by the browser to a text cursor when dragging. So how?

http://jsfiddle.net/nick_craver/uZ377/1/

Derek 朕會功夫
  • 92,235
  • 44
  • 185
  • 247

2 Answers2

5

Not sure if it truly solves your problem, but this ( http://jsfiddle.net/garretruh/pJjd4/ ) seems get rid of the text-select cursor by not making text selectable at all. Then again, you might want users to be able to select your text.

garretruh
  • 94
  • 7
  • It works! But now the texts other than my `` are now un-selectable. – Derek 朕會功夫 May 26 '12 at 23:36
  • Is something like this ( http://stackoverflow.com/questions/891581/how-can-i-disable-text-selection-temporarily-using-javascript ) what you're looking for? I think in order to temporarily disable text-selection for the drag, but enable it in normal usage, Javascript is a must. Unless you want to create a pseudo-copy of the element to be dragged around until it is dropped, upon which text-selection is re-enabled. – garretruh May 27 '12 at 01:15
  • Please, do write your code here, because jsfiddle is not available for some people. – Evgeni Nabokov Jun 17 '15 at 12:52
0

I realize this is over a year old, but just change the * selector at the top of that JSFiddle to only match the element that you are dragging around. No Javascript required.

SO'Brien
  • 126
  • 1
  • 10