I´m talking about this Galleria plugin. Maybe this is too simple, but I can´t find anything in the documentation page: I have this galleria implementation. I want to add a different link to every image, so that the user can click on some image and go somewhere. How can I do that? Or where to find the answer?
Galleria plugin: How to add links?
Asked Answered
Another option is to give the URL that you want to link to in the longdesc attribute of your IMG tag, like this:
<img src="mypic1.jpg" longdesc="http://www.amazon.co.uk" >
<img src="mypic2.jpg" longdesc="http://www.google.com" >
The Galleria code will automatically create a link from the longdesc URL if you supply one. This is a documented feature, but it is rather tucked away.
Gaaaah... Thank you so much. I was scratching my head hardcore until I found your answer. Galleria's author really needs to document that better. –
Placket
You can also define the images as a JSON array:
<script>
var data = [
{
image: 'img1.jpg',
thumb: 'thumb1.jpg',
title: 'my first image',
description: 'Lorem ipsum caption',
**link**: 'http://domain.com'
},
{
image: 'img2.jpg',
thumb: 'thumb2.jpg',
title: 'my second image',
description: 'Another caption',
link: '/path/to/destination.html'
}
];
$('#container').galleria({
data_source: data
});
</script>
see link property above.
data_source also can be dataSource, see galleria.aino.se/docs/1.2/references/data –
Hudgins
© 2022 - 2024 — McMap. All rights reserved.