954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help With Lightbox

Hi Guys,
I have an image set up, and when you left-click on it, the image closes.
I was wondering if there is an onRightClick event or something like that, so I can disable the right-click menu?

I'm trying to prevent people from being able to easily save the image.

Any ideas?

AnzJ
Newbie Poster
12 posts since Nov 2006
Reputation Points: 20
Solved Threads: 0
 

It can't be done.

Even if you were able to disable all forms of browser controls which save images, the print screen function always saves the visible screen to the clipboard. Then you can paste the screen to mspaint, cut out the image, and save it.

MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
 

midiMagic.. Thanks for the response.
I know that there is always a way around everything, but I'm just trying to take away ONE option (and the most well known). Most people will try to right click-save as, and failing that, they'll give up.

There must be some way to detect a right-click.... I can program the rest from there

RockOn

AnzJ
Newbie Poster
12 posts since Nov 2006
Reputation Points: 20
Solved Threads: 0
 

Just a small hint for you. Make changes to suit your purposes since handing out complete solutions won't be such a good idea... ;-)

document.onmousedown=disableclick

function disableclick(e) 
{

    var message = "Right click is disabled";
    if (document.all) 
    {
        if (event.button==2||event.button==3) 
        {
            alert(message);
            return false;
        }
    }

    if(document.layers || document.getElementById && !document.all)
    {
        if (e.which == 3 || e.which == 2) 
        {
            alert(message);
            return false;
        }
    }
}


I would assume that you know where to place this code.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

can i ask also about lightbox? i am also using that one. but my problem is when i mouse over the thumbnail picture, the caption was displayed but the code was also displayed.. im trying to put the comment one line after the other.. it worked but there's a problem when i used mouse over.. can someone help me? thank you..

tinatina
Newbie Poster
1 post since Nov 2007
Reputation Points: 10
Solved Threads: 0
 

Hi,

You can do this for only lightbox.

Replace the following code in lightbox.js,

Original:

Builder.node('div',{id:'imageContainer'}

Replaced:

Builder.node('div',{id:'imageContainer',oncontextmenu:'return false;'}

gtugay
Newbie Poster
1 post since Mar 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You