当使用mousedown的时候,区分是鼠标的哪个键被按下了。

jQuery 提供了e.button 属性来查看到底是那个键被按下了

返回值有   0      1     2   三个

分别对应 左键  中键  右键。

 

示例代码:

 $(document).on({

mousedonw:function(e){
alert(e.button);
}
});

 

相关文章:

  • 2021-06-10
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2021-10-03
  • 2021-12-20
  • 2022-12-23
相关资源
相似解决方案