View Full Version : Adding an array with links to a photo gallery

10-05-2011, 02:37 PM
I've got this little chunk of code running on my freelance portfolio site - on each page (different sections of my portfolio) I have 6 thumbnails and a full sized graphic with some descriptive info, you click the thumbnail and it switches the graphic and other info, that all works fine.

But on one page I have some web stuff and I'd like to make the var 'clientinfo' into a link to go to the client's website. I know I need to add an array with the website links, but then I'm not sure how to implement it into the html, I've tried various things I've found on here but I'm not getting anywhere on my own. I know it's something pretty simple (for someone who knows what they're doing) but I just can't seem to grasp it. Can anyone help?

the js is like this:
$(function() {
$(".image").click(function() {
var image = $(this).attr("rel");
var title = $(this).attr("title");
var description = $(this).attr("content");
var clientinfo = $(this).attr("clientinfo");

$('#image').html('<img src="' + image + '"/>');
return false;

and then the HTML anchors are like this:

<a href="#" rel="images/gallery/web/site1.png" title="Site One" content="This is the descriptive info for site number one" clientinfo="Site One link" class="image"><img src="images/gallery/web/t_site1thumb.png" class="thumb" border="0"/></a>

10-05-2011, 05:14 PM
You need to change this part:

var clientinfo = $(this).attr("clientinfo");

...into your client's website like:

var clientinfo = 'http://codingforums.com';

10-05-2011, 05:28 PM
Thanks for that, sorry I should have been more clear - I'll need to have different links for each client, so I know I'll need an array, I'm just stuck on how to implement it.

10-07-2011, 12:09 AM
sorry to bump my own post but I'm still not able to get this to work...