I have this code to detect mouse down. However on android phones, mouse down for a long time often converts to a right click. Is there a way I can only get information about left mouse click?
var mouseDown = 0;
document.body.onmousedown = function() {
++mouseDown;
}
document.body.onmouseup = function() {
--mouseDown;
}
using this as the code below
if (mouseDown){
xyz happens
}
Still a beginner, please tell me what to change in both the codes.
Thanks
This might help you,
$(document).ready(function() {
$(document).mousedown(function(e) {
if (e.which === 1) {
alert("left");
}else if(e.which === 3){
alert("right");
}
});
});