I have been using the Freewall jQuery plugin in order to generate a responsive grid-based image gallery. Such a piece of work, I have to say. However, I have been struggling to find a way to make the pictures linkable, given that the images of the gallery are retrieved in an automated manner:
<script type="text/javascript">
var temp = "<div class='cell' style='width:{width}px; height: {height}px; background-image: url(grid-images/photo/{index}.jpg)'></div>";
var w = 280, h = 320, html = '', limitItem = 15;
for (var i = 0; i < limitItem; ++i) {
html += temp.replace(/\{height\}/g, h).replace(/\{width\}/g, w).replace("{index}", i + 1);
}
$("#freewall").html(html);
var wall = new freewall("#freewall");
wall.reset({
selector: '.cell',
animate: true,
cellW: 280,
cellH: 320,
onResize: function() {
wall.refresh();
}
});
wall.fitWidth();
// for scroll bar appear;
$(window).trigger("resize");
</script>
In other versions of the code, Minh has placed the code of every single picture of the gallery in the html file. What I find particularly useful is the automated retrieval of the JS code and I would like to know... Is there an automated way of associating each of the pictures to a certain link, thus making the pictures linkable?
That would be: 1 to A, 2 to B, 3 to C and so on.