Results 1 to 6 of 6

Thread: CMotion Gallery works sporadically

  1. #1
    Join Date
    Aug 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default CMotion Gallery works sporadically

    1) Script Title:
    CMotion Gallery

    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...iongallery.htm

    3) Describe problem:

    http://www.kydex.com/

    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.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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:

    http://www.dynamicdrive.com/forums/s...ad.php?t=13302

    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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){
    revivecontent()
    window.frames[4].fillup();
    window.frames[5].fillup();
    }
    if (ccollect.length>0 && statecollect.length>0)
    revivestatus()
    }

    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?

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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:

    Code:
    document.getElementsByTagName('iframe')[1].src='about:blank';
    would set the second iframe (on the page) element's source attribute to about:blank and:

    Code:
    document.getElementsByTagName('iframe')[1].src='http://www.kydex.com/widget_partgallery.asp';
    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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Aug 2006
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for your continued help. Your post got me thinking and I tried adding the following lines to the expandcontent function:
    window.frames[4].fillup();
    window.frames[5].fillup();

    Problem solved.... at least it appears to be:
    http://www.kydex.com

    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?
    Last edited by Mminnig; 03-15-2007 at 06:57 PM.

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You can give your iframes names:

    HTML Code:
    <iframe name="wparts" . . .
    and:

    HTML Code:
    <iframe name="warticles" . . .
    Then you can access them as:

    Code:
    window.frames['wparts'].fillup();
    and:

    Code:
    window.frames['warticles'].fillup();
    respectively and it won't matter the order on the page that they occupy as long as their names are unique.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •