On my company's main webpage, I decided to put some info about each of the applications when you hover over the links to them. Using the basic function from this page, I came up with this - which works out pretty nice:
Enjoy
-kaht
[small]How spicy would you like your chang sauce? Oh man... I have no idea what's goin' on right now...[/small]
![[banghead] [banghead] [banghead]](/data/assets/smilies/banghead.gif)
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<title>Opacity Test</title>
<link rel="shortcut icon" href="./images/arch-icon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript">
/*<![CDATA[*/
var showInterval = [false, false, false];
var hideInterval = [false, false, false];
var opacityValue = [0, 0, 0];
function showDiv(objNum) {
//check to see if we're currently hiding this div, if so we stop execution on that interval
if (hideInterval[objNum]) {
clearInterval(hideInterval[objNum]);
hideInterval[objNum] = false;
}
//store a reference to this interval so we can stop it later
showInterval[objNum] = setInterval("showDivFunction(" + objNum + ")", 50);
}
function showDivFunction(objNum) {
var obj = document.getElementById("link" + objNum);
//if the div is not fully shown, we increase the opacity in 10% increments
if (opacityValue[objNum] < 100) {
opacityValue[objNum] += 10;
obj.style.opacity = (opacityValue[objNum] / 100);
obj.style.MozOpacity = (opacityValue[objNum] / 100);
obj.style.KhtmlOpacity = (opacityValue[objNum] / 100);
obj.style.filter = "alpha(opacity=" + opacityValue[objNum] + ")";
}
//if the div is fully shown we clear the interval and set the reference to false
else {
clearInterval(showInterval[objNum]);
showInterval[objNum] = false;
}
}
function hideDiv(objNum) {
//check to see if we're currently showing this div, if so we stop execution on that interval
if (showInterval[objNum]) {
clearInterval(showInterval[objNum]);
showInterval[objNum] = false;
}
hideInterval[objNum] = setInterval("hideDivFunction(" + objNum + ")", 50);
}
function hideDivFunction(objNum) {
var obj = document.getElementById("link" + objNum);
//if the div is not fully hidden, we decrease the opacity in 10% increments
if (opacityValue[objNum] > 0) {
opacityValue[objNum] -= 10;
obj.style.opacity = (opacityValue[objNum] / 100);
obj.style.MozOpacity = (opacityValue[objNum] / 100);
obj.style.KhtmlOpacity = (opacityValue[objNum] / 100);
obj.style.filter = "alpha(opacity=" + opacityValue[objNum] + ")";
}
//if the div is fully hidden we clear the interval and set the reference to false
else {
clearInterval(hideInterval[objNum]);
hideInterval[objNum] = false;
}
}
/*]]>*/
</script>
<style type="text/css">
* {
border:0px;
margin:0px;
padding:0px;
}
ul {
list-style-type:none;
}
ul li {
display:inline;
padding:0px 10px;
border-left:1px solid black;
}
ul li.first {
border-left:0px;
}
div#link0, div#link1, div#link2 {
height:100px;
width:100px;
opacity: 0.0;
-moz-opacity: 0.0;
-khtml-opacity: 0.0;
filter: alpha(opacity=0);
}
div#link1, div#link2 {
margin-top:-102px;
margin-left:50px;
}
div#link0 {
margin-top:30px;
margin-left:50px;
border:1px solid blue;
}
div#link1 {
border:1px solid green;
}
div#link2 {
border:1px solid red;
}
</style>
</head>
<body>
<ul>
<li class="first"><a href="[URL unfurl="true"]http://www.google.com"[/URL] onmouseover="showDiv(0)" onmouseout="hideDiv(0)">Hover over me!</a></li>
<li><a href="[URL unfurl="true"]http://www.google.com"[/URL] onmouseover="showDiv(1)" onmouseout="hideDiv(1)">And me too!</a></li>
<li><a href="[URL unfurl="true"]http://www.google.com"[/URL] onmouseover="showDiv(2)" onmouseout="hideDiv(2)">Don't forget me, I'm link number3</a></li>
</ul>
<div id="link0">This is the first div</div>
<div id="link1">Hello, I am div number 2</div>
<div id="link2">And of course you can't forget me<br />I'm lucky number 3</div>
</body>
</html>
Enjoy
-kaht
[small]How spicy would you like your chang sauce? Oh man... I have no idea what's goin' on right now...[/small]
![[banghead] [banghead] [banghead]](/data/assets/smilies/banghead.gif)