Results 1 to 3 of 3

Thread: Want to add captions to the CMotion Script

  1. #1
    Join Date
    May 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Want to add captions to the CMotion Script

    Script: CMotion Image Gallery
    http://www.dynamicdrive.com/dynamici...iongallery.htm

    Hi there,

    I'm trying to making a gallery out of this CMotion. My progress so far is this:
    http://beard.dialnsa.edu/~lain/motio...ongallery.html

    and I cannot move on. I am wishing to pop up a caption besides each product, when corresponding thumbnail is clicked, is there anyway that can be done?

    A guy in another forum tried to help me out with this script:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    
    <head>
      <title></title>
    <script language="JavaScript" type="text/javascript">
    <!--
    
    function PopUp(mid,msrc,mesid,txt,xos,yos){
     var mainobj=document.getElementById(mid);
     var messobj=document.getElementById(mesid);
     mainobj.src=msrc;
     messobj.innerHTML=txt;
     zxcStyle(messobj,{visibility:'visible',left:(zxcPos(mainobj)[0]+xos)+'px',top:(zxcPos(mainobj)[1]+yos)+'px'});
    }
    
    function PopDown(id){
     zxcStyle(document.getElementById(id),{visibility:'hidden'});
    }
    
    function zxcStyle(zxcele,zxcstyle,zxctxt){
     if (typeof(zxcele)=='string'){ zxcele=document.createElement(zxcele); }
     for (key in zxcstyle){ zxcele.style[key]=zxcstyle[key]; }
     if (zxctxt){ zxcele.appendChild(document.createTextNode(zxctxt)); }
     return zxcele;
    }
    
    function zxcPos(zxcobj){
     zxclft=zxcobj.offsetLeft;
     zxctop=zxcobj.offsetTop;
     while(zxcobj.offsetParent!=null){
      zxcpar=zxcobj.offsetParent;
      zxclft+=zxcpar.offsetLeft;
      zxctop+=zxcpar.offsetTop;
      zxcobj=zxcpar;
     }
     return [zxclft,zxctop];
    }
    
    
    //-->
    </script>
    
    </head>
    
    <body onload="LoadPopUps();" >
    <a href="#" onmouseover="PopUp('Main','newimg.jpg','M1','some text',100,20);" onmouseout="PopDown('M1');" >LINK</a>
    
    <div id="M1"style="position:absolute;visibility:hidden;width:200px;height:150px;background-color:#FFFFCC;border:solid black 1px;" >
    </div>
    <br>
    <br>
    <img id="Main" src="main.jpg" >
    </div>
    
    </body>
    
    </html>
    It put captions beside the enlarged view, but it also stopped the CMotion script.

    Any correct solution to this?

    Thank you for your time.

  2. #2
    Join Date
    May 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi all, I made the caption work, but then the CMotion Script stops scrolling, can somebody please tell me why? Is it fixable?

    HTML Code:
    http://beard.dialnsa.edu/~lain/motiongallery/motiongallery.html
    This is the js that I used to call for further functions:
    Code:
    <a href="#" onclick="PopUp('enlarged','images/ring/r1.jpg',
    'caption','Model No. <br/>Product Name<br/>Description');" >
    <img src="images/ring/r1(t).jpg"></a>

    Thanks,

    blue38

  3. #3
    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 either need to get rid of this from the body tag:

    Code:
    onload="LoadPopUps();"
    or define LoadPopUps(); prior to page load.
    - 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
  •