Drag cursor in javascript?

北城以北 提交于 2019-12-10 06:37:17

问题


I need to set the drag cursor in some places but i can' see listened here http://www.w3schools.com/cssref/pr_class_cursor.asp

In my case it apears when i drag some image :

http://s2.subirimagenes.com/otros/previo/thump_8236773bgform29.jpg

Is there a code to use like body{cursor: drag} ?


回答1:


You can use the move cursor paramater:

.target {cursor:move}

That cursor you are asking for is unique, if you want to use one with pure CSS then the best for this case is the move cursor.

Edit: For a custom cursor like the one you see, you can use the URL property value

.target{ cursor: url(mycursor.gif), auto; }

You want to specify a default cursor at the end just incase the one specified by the URL cannot be used.

If you want this cursor only to appear when they are dragging then you'll have to apply this CSS rule to the element being dragged when the user clicks on it.




回答2:


You may be able to use the vendor-specific grab cursor, but I don't think the support is quite there yet. It might be best to use a custom icon or, as suggested by Chris B., the move cursor.

.grab {
   cursor: url("http://www.example.com/openhand.cur") 8 8, move;
   cursor: -moz-grab;
   cursor: -webkit-grab;
}

.grabbing {
   cursor: url("http://www.example.com/closedhand.cur") 8 8, move;
   cursor: -moz-grabbing;
   cursor: -webkit-grabbing;
}


来源:https://stackoverflow.com/questions/14319850/drag-cursor-in-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!