inherit
173855
0
Apr 23, 2024 9:59:44 GMT -8
Texas
I check in every once in a while...
869
November 2011
petermaggio
|
Post by Texas on Jul 28, 2013 13:29:38 GMT -8
So I needed people to right click on stuff and have a an alert pop up. So I used this function below to add a jQuery function that would work with right clicks.
(function( $ ) { $.fn.rightClick = function( method ) { $(this).mousedown(function( e ) { if( e.which === 3 ) { e.preventDefault(); method(); } });
}; })( jQuery );
However, when I do $('#someID').rightClick(function(){ proboards.alert('hello')}); it doesn't prevent the context menu from showing. However, it is prevented with everything else.
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Jul 28, 2013 16:10:27 GMT -8
Use "contextmenu" instead of "mousedown".
Just pointing out that some browsers allow the user to prevent disabling or replacing of the right click context menu. I know I have mine disabled, as I can't stand websites that do it.
|
|
inherit
173855
0
Apr 23, 2024 9:59:44 GMT -8
Texas
I check in every once in a while...
869
November 2011
petermaggio
|
Post by Texas on Aug 7, 2013 17:37:32 GMT -8
Well on that note, I'll leave it the way it is.
Thanks for the help.
|
|