How would you do this in javascript/jquery?
I currently have the right-click + hold to show a div, and then it disappears on the release of the right click. However, I would like to click any button the mouse is hovered over on the release of the right click.
This is what I have so far:
// Cancel out the default context menu
$('body').on('contextmenu', function(){
return false;
});
$("body").on('mousedown', function(event){
// If it's not a right click, return
if (event.which != 3)
return;
// Set div coordinates to clicked point
$('div').css({
'top': event.pageY,
'left': event.pageX
});
$('div').show();
});
$("body").on('mouseup', function(event){
// If it's not a right click, return
if (event.which != 3)
return;
$('div').hide();
});
Try attaching the
mouseupevent handler to the buttons.