PDA

View Full Version : Want to add captions to the CMotion Script



blue38
05-19-2006, 06:17 PM
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/motiongallery/motiongallery.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:



<!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.

blue38
05-19-2006, 08:37 PM
Hi all, I made the caption work, but then the CMotion Script stops scrolling, can somebody please tell me why? Is it fixable?


http://beard.dialnsa.edu/~lain/motiongallery/motiongallery.html

This is the js that I used to call for further functions:


<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

jscheuer1
05-20-2006, 05:04 AM
You either need to get rid of this from the body tag:


onload="LoadPopUps();"

or define LoadPopUps(); prior to page load.