Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding an array with links to a photo gallery

    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");

    $('#gallery').hide();
    $('#gallery').fadeIn('slow');
    $('#image').html('<img src="' + image + '"/>');
    $('#title').html(title);
    $('#description').html(description);
    $('#client').html(clientinfo);
    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>

  • #2
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    You need to change this part:
    Code:
    var clientinfo = $(this).attr("clientinfo");
    ...into your client's website like:
    Code:
    var clientinfo = 'http://codingforums.com';
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #3
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry to bump my own post but I'm still not able to get this to work...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •