jQuery mouseup function on left mouse button only?

假如想象 提交于 2019-12-01 05:43:58

You can check to see which mouse button was pressed using e.which (1 is primary, 2 is middle and 3 is secondary):

$(document).ready(function() {
    $("div").mouseup(function(e) {
        if (e.which != 1) return false;    // Stops all non-left-clicks

        ...
    });
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!