View Full Version : Is ThumbnailViewer2 compatible with Control Modal?

04-21-2007, 04:12 AM
1) Script Title: thumbnailviewer2.js

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

3) Describe problem:

Not a problem per se, more of a conflict... I am wondering if thumbnailviewer2 can be used in conjunction with Control Modal (http://livepipe.net/projects/control_modal/)

See what happens when they try to co-exist :

Click the 2nd thumb on the left column (1st of second row). You'll see an HTML page overlay everything. This page is made up of 1 main image and 3 more thumbnails, using thumbnailviewer2.js.

Hovering over these 3 thumbs does nothing. Not even an error. But when I try it standalone, it works. Obviously, there is a conflict with Control Modal and/or Prototype.

Can someone much more experienced than me spot the conflict and tell me how hard it would be to resolve it, if after taking a look it turns out that that's not even possible, then I'll stop trying.


04-21-2007, 06:50 AM

<script type="text/javascript" src="/scripts/thumbnailviewer2.js" defer="defer"></script>

needs to be like so:

<script type="text/javascript" src="/scripts/thumbnailviewer2.js" defer="defer">
* Image Thumbnail Viewer II script- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use


<a href="pics.html" class="tn modal">

Should be like:

<a href="pics.html" class="tn modal" onmousedown="thumbnailviewer2.alreadyrunflag=0;">

Then on pics.html:

<table onmouseover="if(!thumbnailviewer2.alreadyrunflag){thumbnailviewer2.alreadyrunflag=1;thumbnailviewer2.init();};" border="0" align="center" cellpadding="0" cellspacing="0">
<td align="left" valign="bottom"><div id="loada . . .

That should at least get it working one time, if there are other problems, the cleanup function may need to be run (and perhaps should be anyway) with the onmousedown:

<a href="pics.html" class="tn modal" onmousedown="if(thumbnailviewer2.targetlinks&&(thumbnailviewer2.targetlinks.length||thumbnailviewer2.featureImage)){thumbnailviewer2.cleanup();}thumbnailviewer2.alreadyrunflag=0;">

04-21-2007, 03:23 PM
Thanks, John. Sorry about the legal note in the header, these are just testing files and I was trying to isolate where the conflicts are, so all comments were stripped for the occasion.

It works great on IE6. Didn't try anything else yet but usually when something works on IE6, the worst of it is over. :)


04-23-2007, 07:24 PM
I noticed this code works fine as long as there's only 1 instance of calling an HTML page via Control Modal on any given page.

But it gets hairy when you've got 2 :


In the first thumbnail column, the 2nd and 3rd images link to 2 different HTML pages. As you can see, there are errors galore right now.

How do I fix?


04-23-2007, 07:39 PM
Found the mistake : missing ")" after the cleanup code.

Fixed it..!

04-24-2007, 04:44 PM
Hi, I ran across the issue where if you try to use this .js for multiple pages, it will not unload images. Does the : missing ")" fix this?? If so, where exactly does it go??


04-24-2007, 04:51 PM
I thought they meant they left it out. However, I did, it should be:


I will now go and edit the original post.

04-24-2007, 05:02 PM
Super! Thanks so much! Please let us know when the new one is posted.

04-24-2007, 06:41 PM
I meant the original post, I fixed the error in the original post. DD doesn't let me edit the scripts in the library - yet.

04-24-2007, 06:54 PM
Sorry for being unclear. The missing ")" was indeed missing from John's recommended code. It wasn't me who forgot to put it.

I don't know much about javascript, but I was able to spot the error by comparing the if statement to other code I had.