How to Disable the Mouse wheel click Button?

后端 未结 4 1836
借酒劲吻你
借酒劲吻你 2020-12-17 01:44

I\'m trying to find a way of disabling the default action of the mouse wheel button which is to open the link in a new tab.

Is that possible?

4条回答
  •  时光说笑
    2020-12-17 02:27

    My code:

    $(document).on('auxclick', 'a', function(e) {
    if (e.which === 2) { //middle Click
        e.preventDefault();
        e.stopPropagation();
        e.stopImmediatePropagation();
        return false;
    }
    return true;
    

提交回复
热议问题