编程语言
首页 > 编程语言> > mousedown监听onmousemove判断鼠标指针移动方向的JavaScript

mousedown监听onmousemove判断鼠标指针移动方向的JavaScript

作者:互联网

<script>
document.getElementById("inputid").addEventListener('mousedown', function(event) {
  event.preventDefault()
  var onceweb
  window.onmousemove=function(e){
  e.preventDefault()
  console.log(e)
  if(dis - e.clientY > 0){
    console.log("向上")
    document.getElementById("inputid").value++
  }else{
    console.log("向下")
    document.getElementById("inputid").value--
  }
  onceweb = e.clientY
  }
  window.onmouseup=function(e){
    window.onmousemove=null
  }
});
</script>

标签:console,log,JavaScript,window,inputid,mousedown,onmousemove,document
来源: https://www.cnblogs.com/onceweb/p/14629753.html