📜  html 拖动获取鼠标位置 - Html 代码示例

📅  最后修改于: 2022-03-11 14:53:29.175000             🧑  作者: Mango

代码示例2
//  JavaScript

document.addEventListener("dragover", function(e){
    e = e || window.event;
    var dragX = e.pageX, dragY = e.pageY;

    console.log("X: "+dragX+" Y: "+dragY);
}, false);

//  jQuery

$("body").bind("dragover", function(e){
    var dragX = e.pageX, dragY = e.pageY;

    console.log("X: "+dragX+" Y: "+dragY);
});