PDA

View Full Version : second OnClick issues with CMotion



nathanimate
02-24-2012, 12:19 PM
CMotion Image Gallery

http://www.dynamicdrive.com/dynamicindex4/cmotiongallery.htm

I am trying to add a second behavior to the thumbs in the motiongallery (ideally a second onClick so as to swap 2 images in 2 different layers).
The idea is that when someone clicks a specific thumb with one click, this swaps 2 other images.
This however, results in suceeding in swapping the 2 images, but the motiongallery has no motion whatsoever.

Example (added onClick in Red):
<nobr id="trueContainer"><img src="thumb_minute.gif" onClick="MM_swapImage('flybath','','minute.gif',0);MM_swapImage('strip1','','strip2.gif',1)">
<img src="thumb_caged.gif" onClick="MM_swapImage('flybath','','caged.gif',0)">
<img src="thumb_sinking.gif" onClick="MM_swapImage('flybath','','flybath.gif',0)">
<img src="thumb_harmony.gif" onClick="MM_swapImage('flybath','','harmony.gif',0)"></nobr>

The text in red is the only thing that has changed. The motiongallery was working perfectly prior to this addition.

jscheuer1
02-25-2012, 05:23 AM
Please include a link to the page on your site that contains the problematic code so we can check it out.

nathanimate
02-26-2012, 11:39 AM
Please click on first thumbnail in the motiongalleries below.
working (http://testdomainforme.web44.net/testok.html)
not working (http://testdomainforme.web44.net/testnotok.html)

jscheuer1
02-26-2012, 01:35 PM
The problem has nothing to do with the second call to MM_swapImage() and in fact this is not the only difference between the two pages. Aside from the fact that they each employ a different version of MM_swapImage(), the non-working example also uses a body onload attribute. The differences in version of MM_swapImage() are not a problem. This body onload attribute is. It effectively overwrites the CMotion Gallery's window.onload event.

To restore it change:


<body link="#999999" vlink="#999999" alink="#999999" onload="MM_preloadImages('strip2.gif')">

to (addition highlighted):


<body link="#999999" vlink="#999999" alink="#999999" onload="fillup(); MM_preloadImages('strip2.gif')">