jQuery 判断鼠标键

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

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

返回值有   0      1     2   三个

分别对应 左键  中键  右键。

 

示例代码:

 $(document).on({

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

 

posted on 2012-06-21 14:24  trance  阅读(561)  评论(0编辑  收藏  举报

导航