so problem this,
i wondering if there way detect if user right clicks , left clicks simultaneously , commit action if doing in jquery. seems code can detect 1 right click or 1 left click @ time in mouse events.
update
thanks answers, decided feature funky have users when trying implement it. these answers able other people too.
you can create variables hold state of each mouse button individually , use determine whether both buttons down:
window.isleftmousedown = false; window.isrightmousedown = false; $(document).on('mousedown', function(e) { if (e.which == 1) window.isleftmousedown = true; else if (e.which == 3) window.isrightmousedown = true; if (window.isleftmousedown && window.isrightmousedown) { console.log('both down'); } }); $(document).on('mouseup', function(e) { if (e.which == 1) window.isleftmousedown = false; else if (e.which == 3) window.isrightmousedown = false; });
Comments
Post a Comment