jamie smith
04-12-2006, 10:03 AM
Hello
I have adapted a dd script for the motion gallery and fade in mouseovers to use in my site and I was wondering if it was possible to use less code. Is it possible to have the opacity filters, mouseovers and borders written only once and then call it every time u mouseover an image. I am new to this so I apologise now if that doesnt make sense.
code:
<html>
<head>
<link href="css1.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="gallerystyle.css" />
<script type="text/javascript" src="motiongallery.js">
/***********************************************
* CMotion Image Gallery- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/
</script>
<script language="JavaScript1.2">
//Highlight image script- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use
function makevisible(cur,which){
strength=(which==0)? 1 : 0.5
if (cur.style.MozOpacity)
cur.style.MozOpacity=strength
else if (cur.filters)
cur.filters.alpha.opacity=strength*100
}
</script>
<style type="text/css">
.roll2{
margin-left:17px;
}
</style>
</head>
<body>
<div class="container">
<div class="testbox"><div id="motioncontainer" style="position:relative;width:649px;height:76px;overflow:hidden;">
<div id="motiongallery" style="position:absolute;left:0;top:0;white-space: nowrap;">
<nobr id="trueContainer"> <a href="#"><img src="pic/ro1bb.jpg" style="filter:alpha(opacity=50);-moz-opacity:0.5" onMouseover="makevisible(this,0)" onMouseout="makevisible(this,1)" border="0"></a>
<a href="#"><img src="pic/ro2bb.jpg" style="filter:alpha(opacity=50);-moz-opacity:0.5" onMouseover="makevisible(this,0)" onMouseout="makevisible(this,1)" border="0" class="roll2"></a>
<a href="#"><img src="pic/ro3bb.jpg" style="filter:alpha(opacity=50);-moz-opacity:0.5" onMouseover="makevisible(this,0)" onMouseout="makevisible(this,1)" border="0" class="roll2"></a>
<a href="#"><img src="pic/ro4bb.jpg" style="filter:alpha(opacity=50);-moz-opacity:0.5" onMouseover="makevisible(this,0)" onMouseout="makevisible(this,1)" border="0" class="roll2"></a>
<a href="#"><img src="pic/ro5bb.jpg" style="filter:alpha(opacity=50);-moz-opacity:0.5" onMouseover="makevisible(this,0)" onMouseout="makevisible(this,1)" border="0" class="roll2"></a></nobr></div>
</div>
</div>
</div>
</div>
</body>
</html>
code/
Thanks
I have adapted a dd script for the motion gallery and fade in mouseovers to use in my site and I was wondering if it was possible to use less code. Is it possible to have the opacity filters, mouseovers and borders written only once and then call it every time u mouseover an image. I am new to this so I apologise now if that doesnt make sense.
code:
<html>
<head>
<link href="css1.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="gallerystyle.css" />
<script type="text/javascript" src="motiongallery.js">
/***********************************************
* CMotion Image Gallery- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/
</script>
<script language="JavaScript1.2">
//Highlight image script- By Dynamic Drive
//For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
//This credit MUST stay intact for use
function makevisible(cur,which){
strength=(which==0)? 1 : 0.5
if (cur.style.MozOpacity)
cur.style.MozOpacity=strength
else if (cur.filters)
cur.filters.alpha.opacity=strength*100
}
</script>
<style type="text/css">
.roll2{
margin-left:17px;
}
</style>
</head>
<body>
<div class="container">
<div class="testbox"><div id="motioncontainer" style="position:relative;width:649px;height:76px;overflow:hidden;">
<div id="motiongallery" style="position:absolute;left:0;top:0;white-space: nowrap;">
<nobr id="trueContainer"> <a href="#"><img src="pic/ro1bb.jpg" style="filter:alpha(opacity=50);-moz-opacity:0.5" onMouseover="makevisible(this,0)" onMouseout="makevisible(this,1)" border="0"></a>
<a href="#"><img src="pic/ro2bb.jpg" style="filter:alpha(opacity=50);-moz-opacity:0.5" onMouseover="makevisible(this,0)" onMouseout="makevisible(this,1)" border="0" class="roll2"></a>
<a href="#"><img src="pic/ro3bb.jpg" style="filter:alpha(opacity=50);-moz-opacity:0.5" onMouseover="makevisible(this,0)" onMouseout="makevisible(this,1)" border="0" class="roll2"></a>
<a href="#"><img src="pic/ro4bb.jpg" style="filter:alpha(opacity=50);-moz-opacity:0.5" onMouseover="makevisible(this,0)" onMouseout="makevisible(this,1)" border="0" class="roll2"></a>
<a href="#"><img src="pic/ro5bb.jpg" style="filter:alpha(opacity=50);-moz-opacity:0.5" onMouseover="makevisible(this,0)" onMouseout="makevisible(this,1)" border="0" class="roll2"></a></nobr></div>
</div>
</div>
</div>
</div>
</body>
</html>
code/
Thanks