MyBB Community Forums

Full Version: Do not right-click the image.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
No problem. Smile
instead of using jquery and making things complicated, i believe that this piece of code would just do it.... add it in headerinclude and relax Smile

this is the script that i have recommended to a site where i am a member of and it works perfectly....

the good thing about this script is that this actually disables the right click only on images but on other elements you can right click Toungue

<script type="text/javascript">
var alertMsg = "//ENTER YOUR CUSTOM WARNING MESSAGE HERE//";
function nocontext(e) {
var clickedTag = (e==null) ? event.srcElement.tagName : e.target.tagName;
if (clickedTag == "IMG") {
alert(alertMsg);
return false;
}
}
document.oncontextmenu = nocontext;
</script>
I guess jQuery makes things simpler than traditional Javascript.
The function provided with jQ is also affects only on images. I don't know what made you believe that has an impact to the whole.
This code seems to not work bro.

where I had to put it down. ?

code given by the effone but nothing seems to work its option.

if there is the option I might get a user to click on the option that I gave.
I can't get what you say.
However the code provided by me is tested and it will affect every single image of your site regardless of any "option" > if anyone right click on any of the images in your site : no context menu will appear.
(2013-07-10, 01:49 PM)ikhwanulfikri Wrote: [ -> ]This code seems to not work bro.
where I had to put it down. ?

i can be 100% sure that it works bro, because i am using it on my friend's site for more than 5/6 months now.... Big Grin

(2013-07-10, 01:42 PM)effone Wrote: [ -> ]I don't know what made you believe that has an impact to the whole.

because i didnt actually check the thread you have linked.... sorry for that, checked just now Smile


(2013-07-10, 02:07 PM)effone Wrote: [ -> ]However the code provided by me is tested and it will affect every single image of your site regardless of any "option" > if anyone right click on any of the images in your site : no context menu will appear.

i guess he needs a popup or something saying that it is diabled Toungue
hello effone.

I want the code given option.

I want to give the user the option to right-click when he's doing. or go back to the image.
Based on the picture in your first post, it is using css, not js.
if you could give me a little code for the option to right click on the image mei chan.?
It use CSS background properties. You can look at your showthread.css.
Pages: 1 2 3