简体   繁体   中英

Is there a way to get the position of the "ghost image" when dragging an element

I was wondering if there is a way to get the position of the dragged ghost image of an element.

The setup is as follows:

<div id="test" v-on:dragstart="dragStart" v-on:drag="dragging" draggable="true" v-on:drop="drop" v-on:dragover="allowDrop"></div>

the position of the ghost image will be the same as the position of the pointer / mouse pointer. Since you are using jQuery, these coordinates (position) can be acquired this way:

$("body").mousemove(function(e) {
    console.log('position of ghost image: ' + e.pageX + ', ' + e.pageY;
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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