```javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<img src="img/1.png" alt="" id="img1"><img src="img/trash.png" id="img2">
<script>
// 拖拽
// 高频事件
// img1.ondrag = function(e) {
// console.log("ondrag", e)
// }
// 拖拽进入
img1.ondragstart = function() {
console.log("ondragstart");
}
// 拖拽离开(拖拽松开)
img1.ondragend = function() {
console.log("ondragend");
}
// 拖拽开始(进入元素本身)每次拖拽开始也会触发
img1.ondragenter = function() {
console.log("ondr
html5中的ondrop事件
最新推荐文章于 2023-05-30 16:01:31 发布