rooftop — 2012-02-02T09:55:33-05:00 — #1
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.
sdleihssirhc — 2012-02-03T16:06:00-05:00 — #2
Can you link to a live example?
paul_wilkins — 2012-02-03T18:04:22-05:00 — #3
The event.which property will give you 1, 2 or 3 for the left, middle or right mouse button that was clicked.
rooftop — 2012-02-06T07:11:28-05:00 — #4
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!
sdleihssirhc — 2012-02-07T17:22:04-05:00 — #5
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.
rooftop — 2012-02-07T17:59:25-05:00 — #6
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....