Jojoxx.net

 

 

AnvändareAnvändare
Besökare just nu: 50
SnabblänkarSnabblänkar
JavaScript-arkivet
Perl
FAQ
Sök på Jojoxx.netSök på Jojoxx.net



Bildfade

Exempel

Kod


<div style="width:640px;height:250px;display:inline-block;">
<div id="fadea" style="position:absolute;visibility:hidden;"><img src="/images/testbild101.jpg" width="640" height="250" alt="Fade"/></div>
<div id="fadeb" style="position:absolute;visibility:hidden;"><img src="/images/testbild102.jpg" width="640" height="250" alt="Fade"/></div>
<div id="fadec" style="position:absolute;visibility:hidden;"><img src="/images/testbild103.jpg" width="640" height="250" alt="Fade"/></div>
</div>

<script type="text/javascript">
/*  The code contained in this  file is copyrighted by www.jojoxx.net
The file may be used for none commercial applications and distributed
as long as these lines remain intact.  The file or part of it may not
be sold  or  included  in any  other commercial  application  without
agreement from the author. If you have questions or comments, contact
the author at http://www.jojoxx.net

© Copyright - www.jojoxx.net - 2004                                */

var divs=["fadea","fadeb","fadec"];
var zindex=0;
function fade(n,diff,opacity){
	id=divs[n];
	opacity=(opacity)?opacity:(diff<0)?100:0; opacity+=diff;
	if(document.getElementById&&document.all){
		document.getElementById(id).style.filter="alpha(opacity="+opacity+")";
	}else if(document.getElementById&&!document.all){
		document.getElementById(id).style.MozOpacity = opacity/100;
		document.getElementById(id).style.opacity = opacity/100;
	}
	document.getElementById(id).style.visibility="visible";
	if(opacity>=99){
		zindex++;
		document.getElementById(id).style.zIndex=zindex;
		setTimeout("fade("+n+",-"+diff+","+opacity+");",2000);
		nn=(n==divs.length-1)?0:n+1;
		setTimeout("fade("+nn+","+diff+");",2000);
	} else if(opacity>0){
		setTimeout("fade("+n+","+diff+","+opacity+");",30);
	}
}
fade(0,1);
</script>

,