View Full Version : CMotion Gallery works sporadically

03-15-2007, 01:48 PM
1) Script Title:
CMotion Gallery

2) Script URL (on DD):

3) Describe problem:


On the right side of the page, there are two iframes that make use of the Motion Gallery script. "Parts" and "Case Studies". Each one references a seperate .asp page: http://www.kydex.com/widget_partgallery.asp and http://www.kydex.com/widget_articles.asp

If the boxes are expanded on page load, then the Motion Galleries work properly.

However, if the boxes are not expanded until after page load, then the Motion Galleries do not function at all.

03-15-2007, 02:46 PM
It does work in Opera, not in IE 7. It probably will work in FF but, I haven't tested that.

The script uses the dimensions of the page/window to initialize. With an iframe, the iframe is the window. If the iframe is collapsed, there is nothing to work with.

This is most critical in IE.

You may want to use an Object Oriented version of the script:


That way multiple galleries can be on the same page, no iframe required. Divisions could then be used set to display:none or display:block to contain each gallery and to determine which one(s) the user sees. It may be necessary to delay setting any of them to display:none until the page (or at least a particular gallery) has loaded.

03-15-2007, 03:06 PM
Thanks for your quick response.

The object oriented version looks great, but I would like to try to get this version working before I give up and re-do the implementation.

The scripts were working beautifully before I added the large iframe in the center of the page "KYDEX sheet in the news". Example: http://www.kydex.com/default_test.asp

When I added that large iframe in the center http://www.kydex.com, I had to modify my script:
if (enablepersist=="on" && get_cookie(window.location.pathname)!="" && ccollect.length>0){
if (ccollect.length>0 && statecollect.length>0)
to reflect the new numbers for the window.frames
This managed to get it working when the windows are already expanded, but did absolutely nothing for them if they are contracted.

I'm not sure what else would need to be updated?

03-15-2007, 04:09 PM
The real problem is likely initializing a gallery when the browser can't see it as having any window dimensions. The gallery you are using initializes onload so, it might work out if you changed the src attribute of the iframe to about:blank when hiding it and back to the appropriate external page when revealing it. To access the src attribute of an iframe, you must get it as an element, not as a window. Example:


would set the second iframe (on the page) element's source attribute to about:blank and:


would set its source to the widget_part gallery.

It would probably be best to only change the src attribute while the iframe is displayed.

03-15-2007, 06:33 PM
Thank you for your continued help. Your post got me thinking and I tried adding the following lines to the expandcontent function:

Problem solved.... at least it appears to be:

Thank you again... although, the next time I have an extra hour, I will likely switch to the object oriented version. Excellent update!

EDIT: Almost worked.... Ugh. The solution above worked for the home page. However, since there is one less iframe on the other pages, it only caused the second iframe to initialize on those pages.... Any ideas on a clean way to solve this?

03-15-2007, 08:18 PM
You can give your iframes names:

<iframe name="wparts" . . .


<iframe name="warticles" . . .

Then you can access them as:




respectively and it won't matter the order on the page that they occupy as long as their names are unique.