Jump to content

how do i get a link to change dynamically with images from a thumbnail gallery?


ana1020

Recommended Posts

hi,

 

i programmed this website http://www.liveatsummitsprings.com/homes.html using a javascript image gallery (http://devkick.com/lab/galleria/). it's pretty fancy and i don't pretend to understand it fully. i want a 'Download this PDF' link for every picture that is currently enlarged, but the link has to change dynamically, the same way each picture changes on click, since each picture has a specific pdf.

 

i think i have to use the 'onclick' function, but i don't know javascript enough to be sure. i don't know if i need to have an array which stores each file path (i.e. pdf1 = "<a href= "pdf/MountainLaurelSheets.pdf"></a>"; pdf2 = "<a href= "pdf/HickorySheets.pdf"></a>"; ... etc.).

 

does anyone know how to get a link to change dynamically with its corresponding image?

 

- ana

Link to comment
Share on other sites

Hi ya,

 

You can try something along the lines of this;

 

<html>

<a href="pdf1" id="pdf_link">blah</a>

 

<code>

document.getElementById('pdf_link').href = pdf2;

 

You have the ability to alter pretty much any attribute of pretty much any element (a little overstated but yer) at runtime so during some event such as the onclick event of another link you can then add the above code to alter the href attribute of the link.

 

Hope it helps,

 

Mike

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.