PDA

View Full Version : Links Not Working?



monet1369
05-02-2007, 07:29 PM
1) Script Title: Image Thumbnail Viewer II

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

3) Describe problem: I hope that this issue hasn't already been discussed, I didn't find it anywhere. I am using the thumbnail viewer II on our site and it works great! Love it! The only problem I am having is that I am unable to get the links to work to enable the user to click on the small image (gif) to open up a large picture in a new window. There must be something silly I am doing. Any help would be greatly appreciated.:)


monet1369

monet1369
05-02-2007, 07:40 PM
I do apologize, as I should have included the url to our website. It is as follows: http://www.oldhickory.com/html/newitems.html

jscheuer1
05-03-2007, 06:43 AM
This script doesn't do that. And, as this script does open the larger image right on the page, why would you want it to?

monet1369
05-03-2007, 10:25 AM
Thanks for the info. My boss wants this script to open the larger images. I guess our reps are complaining. Picky, picky.

Thanks!:)

jscheuer1
05-03-2007, 04:06 PM
What the script can do is open a page onclick of the larger image:


<a href="../catalog/deaconbench.jpg" rel="enlargeimage::mouseover" rev="loadarea::../catalog/deaconbench.jpg"><img src="../catalog/deaconbench.gif"></a>

However, that will not be a new window. It could be made to be one by editing the script here:


imageHTML='<a target="_new" href="'+dest+'">'+imageHTML+'</a>'

jscheuer1
05-03-2007, 04:41 PM
Now, this is a bit tricky. But, if you have your rev attributes set correctly as shown in my previous post, you can get the thumbnails to use those as well to open a new window onclick by adding this script right before your closing </body> tag:


<script type="text/javascript">
function link_em(){
var link_func=function(e){
var e=window.event? window.event : e? e : null;
var lk=e&&e.target? e.target.parentNode : e&&e.srcElement? e.srcElement.parentNode : null;
if(lk&&lk.getAttribute('rev',0)&&lk.getAttribute('rev',0).split('::')[1])
window.open(lk.getAttribute('rev',0).split('::')[1]);
return false;
}
for (var i_tem = 0, ls=document.links; i_tem < ls.length; i_tem++)
if(/enlargeimage/.test(ls[i_tem].getAttribute('rel',0)))
ls[i_tem].onclick=link_func;
}
if ( typeof window.addEventListener != "undefined" )
window.addEventListener( "load", link_em, false );
else if ( typeof window.attachEvent != "undefined" )
window.attachEvent( "onload", link_em );
else {
if ( window.onload != null ) {
var oldOnload = window.onload;
window.onload = function ( e ) {
oldOnload( e );
link_em();
};
}
else
window.onload = link_em;
}
</script>

monet1369
05-03-2007, 05:21 PM
Thank you so much for all of the suggestions! I will definitely give them a try.

:D

monet1369
05-03-2007, 06:25 PM
That worked like a charm! Thanks sooo much!:D :D