<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script>
document.onmousedown=function(event){
var time = new Date();
document.onmouseup=function(){
var newTime = new Date();
if(newTime-time>300){
console.log("长按~~~~~~");
}else{
console.log("短按~~~~~~");
}
}
}
</script>
</body>
</html>
鼠标自定义判断长按和短按
最新推荐文章于 2023-07-31 11:11:51 发布