简体   繁体   English

在可放置div中拖动div标签时显示插入符号(光标)

[英]show caret (cursor) when dragging div tag in droppable div

I have two divs tag, the first is draggable, the second is droppable and editable. 我有两个divs标签,第一个是可拖动的,第二个是可拖放和可编辑的。

the snip code as below: 截图代码如下:

<div id='dragElement' draggable='true'>draggble element</div>
<div id='dropElement' droppable='true' contentEditable='true'> 
     droppble and editable element
</div>

When i drag first div into the second, i need to show caret (cursor) at the position of mouse is dragging. 当我将第一个div拖入第二个div时,我需要在鼠标拖动的位置显示插入符号(光标)。 My output likes this: http://jsfiddle.net/huynhthinh/T2zHQ/86/ 我的输出像这样: http : //jsfiddle.net/huynhthinh/T2zHQ/86/

Anyone can help me.Thanks all! 任何人都可以帮助我。谢谢大家!

When i drag first div into the second, i need to show the mouse indicator at the position of mouse is dragging. 当我将第一个div拖动到第二个div时,我需要在鼠标拖动的位置显示鼠标指示器。

You can achieve the same using simple css 您可以使用简单的CSS实现相同的功能

try this code 试试这个代码

#dragElement{
    cursor:move;
}

Demo 演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM