PDA

View Full Version : URL onCLick problem in thumbnailviewer2



er777
03-08-2010, 02:29 AM
1) Script Title: thumbnailviewer2.js

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/thumbnail2.htm

3) Describe problem:

I would like to do something which seems simple, but is really a challenge for me.

As I hover over an existing URL I want a picture to "show" on another part of the page, but I STILL want the existing URL link to work when I click on it. The URL IS NOT the same as the image used in the <a href="img"> tag

To be more clear, I want the functionality of the thumbnailviewer loading pictures into the div "loadarea" onMouseover, but I want onClick to take me to a specified URL, not the image that is being referenced in the "a" tag.

Is this do-able?

Thanks!

ddadmin
03-08-2010, 11:24 PM
Try finding the below function inside the .js file:


pagelinks[i]["onclick"]=function(){ //Cancel default click action
return false
}

and change that to:


pagelinks[i]["onclick"]=function(){ //Cancel default click action
var linktarget=this.getAttribute("rev").split("::")[1]
if (linktarget)
window.location=linktarget
return false
}

This causes your thumbnails when clicked on to go to a URL based on that specified inside the rev=loadarea:: attribute:


<a href="http://www.nasa.gov/images/content/167040main_image_feature_738_ys_4.jpg" rel="enlargeimage::mouseover" rev="loadarea::http://www.dynamicdrive.com" title="This is an example">Thumbnail Example 1</a><br />

So with the changes, clicking on the thumbnail link will go to DD, while mousing over it will show the nasa image.

er777
03-09-2010, 12:39 AM
You've solved my problem!

I am so pleased. Can't thank you enough!!

Eddie


:)