jQuery / Javascript: fire a rightclick on a normal-click?
i don't think so but i couldn't find a quick answer! is it possible to show the browsers rightc开发者_StackOverflowlick (context) menu when clicking the left mouse trigger?
thank you
You can't emulate physical browser clicks, such as bringing up the context menu, for security reasons. The closest you'll get to is trapping the click event, which can be done with:
http://jsfiddle.net/zysZC/
$(window).mousedown(function(e) {
if (e.which == 1) { // Left mouse button, 2 = middle, 3 = right
alert('left clicked');
}
});
You may also be interested in this plugin: http://abeautifulsite.net/blog/2008/05/jquery-right-click-plugin/
精彩评论