获取 html5 drop 事件的 xy 坐标

new*_*_86 5 html drag-and-drop

使用 html5 拖放,如何获取在放置事件中放置项目的 x 和 y 位置?我需要动态创建并显示图像和弹出窗口......不使用画布

rob*_*rtc 1

使用标准clientXclientY属性:

function onDrop(ev) {
    window.alert( ev.clientX + ',' + ev.clientY);
    ev.stopPropagation();
    return false;
}
Run Code Online (Sandbox Code Playgroud)