Results 1 to 3 of 3

Thread: CMotion Dynamic Image change

  1. #1
    Join Date
    Jul 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default CMotion Dynamic Image change

    This may be a little obvious and a javascript problem but on a navigation link click, i want to dynamically change the images in the CMotion bar when a new 'garden' selected. This is the script to change the id of the image:

    for (i=1; i<mainArray[arrayNo-1].length; i++)
    {
    thumb = "thb"+(i);
    ImageMain.src = "images/thb_" + mainArray[arrayNo-1][i];
    document.getElementById(thumb).src = ImageMain.src;
    }

    in the html

    <div id="motioncontainer" style="position:relative;width:200px;height:100px;overflow:hidden;">
    <div id="motiongallery" style="position:absolute;left:0;top:0;white-space: nowrap;">
    <nobr><a href="javascript:imgPopUp('1')"><img id="thb1" src="images/thb_1.jpg" border=1></a>
    <a href="javascript:imgPopUp('2')"><img id="thb2" src="images/thb_2.jpg" border=1></a>
    <a href="javascript:imgPopUp('3')"><img id="thb3" src="images/thb_3.jpg" border=1></a>
    <a href="javascript:imgPopUp('4')"><img id="thb4" src="images/thb_4.jpg" border=1></a>
    <a href="javascript:imgPopUp('5')"><img id="thb5" src="images/thb_5.jpg" border=1></a></nobr>
    </div>
    </div>

    Take a look at the site if you like:

    http://www.oliverlong.plus.com/joyjardine/gall.htm

    My apologies for the photos!

    As you can see i am trying to impliment the image system with a navigation bar to allow for multiple sets of images. I'm declare this open source code so please feel free to take what i have done if you like it so far.

    Thanks in advance!

  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

    The most obvious way to change the images shown in the cmotion gallery's train of images is to access and change the element with the id of 'motiongallery'. Ex:

    Code:
    document.getElementById('motiongallery').innerHTML='<nobr>new train of images goes here</nobr>'
    - John
    ________________________

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

  3. #3
    Join Date
    Jul 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks!

    This worked great.

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
  •