PDA

View Full Version : Image Thumbnail Viewer & onclick method



01eg
07-26-2007, 04:23 AM
1) Script Title:
Image Thumbnail Viewer
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex4/thumbnail.htm
3) Describe problem:
Hi,

I would like to use the onClick method instead of rel="thumbnail".
Is it possible? If 'yes' how?

I'm doing a dynamic image gallery using ajax, all images will load from many differents websites.

Thanks a lot.

jscheuer1
07-26-2007, 05:00 AM
The basic onclick would be:


onclick="thumbnailviewer.stopanimation();thumbnailviewer.loadimage(this);return false;"

You may or may not need more than that. If these are being loaded after the initialization of the page, it probably wouldn't hurt to still give the tag the rel attribute.

01eg
07-26-2007, 09:37 PM
Thanks John, works great, just last question: why we need 'stopanimation' func? to stop/clear previous loaded image?

jscheuer1
07-26-2007, 11:54 PM
Thanks John, works great, just last question: why we need 'stopanimation' func? to stop/clear previous loaded image?

Yes, at least that's what's indicated by comments in the script itself:



pagelinks[i].onclick=function(){
thumbnailviewer.stopanimation() //Stop any currently running fade animation on "thumbbox" div before proceeding
thumbnailviewer.loadimage(this) //Load image
return false
}

01eg
07-27-2007, 11:25 AM
Thanks. I'll ask more help in few days. I'm doing testing right now and found that some images are opening in a new window and other images works as expected, I'm talking about the large ones, not the preview ones.