coixo
Power Member
Boas eu nao entendo o pq de nao trabanhar este codigo!
Tive a conduzir por este SITE ...
xfade2.css
msn: [email protected]
Abraços
Tive a conduzir por este SITE ...
xfade2.css
xfade2.js#imageContainer {
height:309px;
}
#imageContainer img {
display:none;
position:absolute;
top:0; left:0;
}
xfade2_0.csswindow.addEventListener?window.addEventListener("load",so_init,false):window.attachEvent("onload",so_init);
var d=document, imgs = new Array(), zInterval = null, current=0, pause=false;
function so_init() {
if(!d.getElementById || !d.createElement)return;
// DON'T FORGET TO GRAB THIS FILE AND PLACE IT ON YOUR SERVER IN THE SAME DIRECTORY AS THE JAVASCRIPT!
// http://slayeroffice.com/code/imageCrossFade/xfade2.css
css = d.createElement("link");
css.setAttribute("href","xfade2.css");
css.setAttribute("rel","stylesheet");
css.setAttribute("type","text/css");
d.getElementsByTagName("head")[0].appendChild(css);
imgs = d.getElementById("imageContainer").getElementsByTagName("img");
for(i=1;i<imgs.length;i++) imgs.xOpacity = 0;
imgs[0].style.display = "block";
imgs[0].xOpacity = .99;
setTimeout(so_xfade,1000);
}
function so_xfade() {
cOpacity = imgs[current].xOpacity;
nIndex = imgs[current+1]?current+1:0;
nOpacity = imgs[nIndex].xOpacity;
cOpacity-=.05;
nOpacity+=.05;
imgs[nIndex].style.display = "block";
imgs[current].xOpacity = cOpacity;
imgs[nIndex].xOpacity = nOpacity;
setOpacity(imgs[current]);
setOpacity(imgs[nIndex]);
if(cOpacity<=0) {
imgs[current].style.display = "none";
current = nIndex;
setTimeout(so_xfade,1000);
} else {
setTimeout(so_xfade,50);
}
function setOpacity(obj) {
if(obj.xOpacity>.99) {
obj.xOpacity = .99;
return;
}
obj.style.opacity = obj.xOpacity;
obj.style.MozOpacity = obj.xOpacity;
obj.style.filter = "alpha(opacity=" + (obj.xOpacity*100) + ")";
}
}
Index.html#imageContainer {
position:relative;
margin:auto;
width:500px;
border:1px solid #000;
}
/* styles unrelated to the application follow */
h1 {
position:relative;
font:1em verdana;
}
.copy {
width:500px;
margin:auto;
position:relative;
font:0.9em verdana;
}
#so_credits {
position:relative;
margin:25px auto 0px auto;
width:350px;
font:0.7em verdana;
border-top:1px solid #000;
border-bottom:1px solid #000;
height:90px;
padding-top:4px;
}
#so_credits img {
float:left;
margin:5px 10px 5px 0px;
border:1px solid #000000;
width:80px;
height:79px;
}
E claro tenho 4 fotos com esse nome no mesmo directório!<html>
<body>
<h1>Image Cross Fader Redux</h1>
<div id="imageContainer">
<img src="img1.jpg" width="500" height="309" alt="Swimming Pool Water" />
<img src="img2.jpg" width="500" height="309" alt="Notebook" />
<img src="img3.jpg" width="500" height="309" alt="Bottle Neck" />
<img src="img4.jpg" width="500" height="309" alt="Nail in a Board" />
</div>
</body>
</html>
msn: [email protected]
Abraços
Última edição: