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
Hello friends.

how to make an image can not right click.

like this picture.

[attachment=29692]
(2013-07-10, 05:00 AM)ikhwanulfikri Wrote: [ -> ]Hello friends.

how to make an image can not right click.

like this picture.

$('img').each(function() {
   $(this)[0].oncontextmenu = function() {
      alert('We\'re sorry. Right-Click is not available');
      return false;
   };
});
hello bro.

Where should I put the code bro. ?
just a note: above is a jQuery function - so jQuery script needs to be loaded and precautions should be taken
so that there is no conflict between jQuery & prototype used in MyBB (eg. add no conflict code, change $ ..)
(2013-07-10, 05:04 AM)ikhwanulfikri Wrote: [ -> ]hello bro.

Where should I put the code bro. ?

Not quite sure. Thought you knew lol..
Found it here. http://css-tricks.com/forums/discussion/...-images/p1

The only thing is people can disable javascript on webpage and be able to right click it.
(2013-07-10, 05:07 AM)VisualizeForums Wrote: [ -> ]
(2013-07-10, 05:04 AM)ikhwanulfikri Wrote: [ -> ]hello bro.

Where should I put the code bro. ?

Not quite sure. Thought you knew lol..
Found it here. http://css-tricks.com/forums/discussion/...-images/p1

The only thing is people can disable javascript on webpage and be able to right click it.

Hahaha .. I think you also know where the code should be placed was not.

(2013-07-10, 05:07 AM).m. Wrote: [ -> ]just a note: above is a jQuery function - so jQueury script needs to be loaded and precautions should be taken
so that there is no conflict between jQuery & prototype used in MyBB (eg. add no conflict code, change $ ..)

helllo. m.

how so I can add the code into the forum.

I was also confused. because I do not understand the javascript code.
suggested function can be added to headerinclude template (take care of the precautions)
waw. thanks effone..

Thank you to all who have helped me.

including
.m. and VisualizeForums
Pages: 1 2 3