Please see below code... Aims of the code is to display a floating menu on right clicking the screen and the menu should hide on left clicking the screen. The below works perfectly with IE and Chrome, but fails in firefox. I tried debugging with firebug, no positives at all.
$(document).ready(function () {
document.onmousedown = onMouseClick;
}
function onMouseDown(ev) {
document.oncontextmenu = onClickRightMouseButton; //to hide default menu on right click
if (ev.which == 1) {
console.log('1');
}
if (ev.which == 2) {
console.log('2');
}
if (ev.which == 3) {
var xPos = ev.clientX;
var yPos = ev.clientY;
document.onmousedown = onMouseClick;
showFloatingMenu(xPos, yPos);
}
function onMouseClick(e) {
if (e.which == 1) {
if (!(e.clientX >= xPos && e.clientX <= (xPos + 200) && e.clientY >= yPos && e.clientY <= (yPos + 50))) { //50x200 is the floating menu diamension
hideFloatingMenu();
}
}
}
}
}
document.onmousedown = onMouseClick
and I seefunction onMouseDown(ev)
$(document).on("mousedown",function(e) {...})
and so on. Also install firebug and hit F12 perhaps there are errors in the console