Support » Plugin: Lightbox Plus Colorbox » Add custom link under image

  • Hello,

    I’m using Lightbox Plus with NextGen gallery.

    I’m looking to add a custom link under each image when lightbox opens (actually a link to a document associated with each image).

    Can you please tell me how I can do this?

    PS: In the NextGen database, I managed to associate each image with the document I want.

    Thank you

Viewing 1 replies (of 1 total)
  • What I did so far (and it works) is:

    1- I added a “doc” attribute to the <a> tag of my image, so I get something like this with the name of the document I want to link to (taken from the nextgen database):

    <a rel="lightbox[set_1]" title="Picture1" href=".../wp-content/gallery/gallery1/pic1.jpg">

    2- I played with the code of jquery.colorbox.js to display my new “doc” attribute instead of the Title attribute, so I turned this:
    settings.title = settings.title || element.title

    Into this:
    settings.title = '<a class="doc" href="/wp-content/uploads/docs/'+$(element).attr('doc')+'">Download File'</a>';}

    And that’s it! Under each picture, I get a link to the document associated with it.

    This is a dirty fix for me. If anyone has a better solution without removing the original title code, please tell me about it. I’m a total noob when it comes to javascript.

Viewing 1 replies (of 1 total)
  • The topic ‘Add custom link under image’ is closed to new replies.