html - 在 html5 drop 事件中获取 xy 坐标

标签 html drag-and-drop

对于 html5 拖放,我如何获得项目在放置事件中放置位置的 x 和 y 位置?那时我需要动态创建和显示图像和弹出窗口...不使用 Canvas

最佳答案

使用标准clientXclientY属性:

function onDrop(ev) {
    window.alert( ev.clientX + ',' + ev.clientY);
    ev.stopPropagation();
    return false;
}

关于html - 在 html5 drop 事件中获取 xy 坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5355903/

相关文章:

html - 如何在 Bootstrap 中将表单输入标签和段落的文本颜色更改为白色

javascript - 未使用预加载的图像

gwt : drag n drop tree

css - -webkit-user-drag css 属性是什么?

html - 当鼠标悬停在 css3 上时,如何使一个图像出现在另一个图像之上?

javascript - 显示最近 6 天的日期时间选择器也知道如何动态删除文本框

html - 保存并刷新所有内容后不会发生任何变化

拖动项目时 JQuery 调用函数

javascript - 刷新时随机化图像

javascript - extjs 5,在gridpanel上deine dropzone,但不能drop,为什么?