I'm setting up a photo gallery (powered by Galleria).
I would like to link an image to a URL and also have the option to 'Save As' that same image using the right click on a mouse.
When I right click with the standard set up for Galleria I get the standard right click menu options pop up but I'm also taken to my URL (before I have time to save the image).
Is there a way to differentiate between a right click and a left click in jQuery so I can, for example, specify that the right click shouldn't action the hyperlink?
Hope thats clear.
Can you link to a live example?
The event.which property will give you 1, 2 or 3 for the left, middle or right mouse button that was clicked.
The demo is at lesco[dot]uk[dot]com/home/landing.php
I've had a quick look at the .js files and can't find the event.which.
This mod is likely to be above my jquery expertise - so I may need to source another gallery which is a pity as this almost ticks all the boxes!
There isn't really an easy way (as far as I can tell).
You designated a "longdesc" attribute for each image. That's how Galleria knows where to link the bigger versions of the images.
Unfortunately, Galleria doesn't simply insert each <img> in an <a> element ([sarcasm]that would be silly[/sarcasm]). Nor does it wait for a normal "click" event (which, if I remember right, is only fired by left-click). It sends you to the "longdesc" location on mouseup.
Even worse, the function that actually decides whether or not to do this isn't in a normal event listener, so it doesn't have access to the "e" object, so you can't just do something as simple as check e.which!
There are workarounds, but they get exponentially more complicated and infuriating the deeper into it you go...
In retrospect, this post probably isn't that much help. To OP, or anyone else interested in pursuing this: The madness begins at about line 3,750 of galleria-1.2.6.js; that's where it decides whether or not to open the link.
I really appreciate your taking the time to try and help (and for writing a witty reply).
I found myself trying to take in the lines around #3750 - but experience was telling I would not make a breakthrough.
I'm reassured that, at least sometimes, I know my limits.
I'm going to try another gallery....
This topic is now closed. New replies are no longer allowed.