js the drag event

js the drag event

api:https://www.runoob.com/jsref/event-ondrag.html

Js native drag event is an event added to the div when using draggable = "true" to drag the div

While dragging, will inspire more events to complete drag

note:

1. Browser block (div, etc.) disabled by default drag event drag and drop, so if you want to monitor drop operation, it is necessary to prevent the occurrence of an element in dragover default behavior, and then you can listen to the drop

dragOver (e) {
   e.preventDefault()
}

2. dragged elements need to obtain information in drag event, you can define global parameters are saved. Use the drop event.

 

 

 

Research is not easy, please indicate the source ......

 

Guess you like

Origin www.cnblogs.com/s313139232/p/11096139.html