Jump to content

[RESOLVIDO]Qual o código para ter um efeito como o das noticias do P@P?


Recommended Posts

Posted

Alguém sabe como é o código que a página inicial do P@P tem para mostrar as noticias?

Fazer elas aparecer ficar x tempo e depois desvanesser?

Eu queria um igual, alguém sabe? 👍

Fiquem bem

Our lives begin to end the day we become silent about things that matter - Martin Luther King

Posted

Aqui está o código como prometido 👍 . Mas não utilizei o link que me deste _JR_, e também não consegui encontrar o script no código do SMF.

<html>
<head>
<title>Skin</title>
</head>
<body>

<!--Script de Texto desvanessente-->
<script type="text/javascript">
//code found in Dynamicdrive.com
//coded edited by Skin
//coments added by Skin

//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//Código onde é possivel edição
var delay = 2000; //tempo em milisegundos para alterar a entrada
var maxsteps=30; // numero de passos para mudar de uma entrada para outra
var stepdelay=40; // tempo em milisegundos de um passo
var startcolor= new Array(255,255,255); // cor inicial (vermelho, verde, azul)
var endcolor=new Array(0,0,0); // cor final (vermelho, verde, azul)

var fcontent=new Array();
begintag=''; //define a tag inicial bem como o estilo a utilizar
fcontent[0]="";//aqui escreve o primeiro texto a aparecer
fcontent[1]="";//aqui escreve o segundo texto a aparecer
fcontent[2]="";//aqui escreve o terceiro texto a aparecer
fcontent[3]="";//aqui escreve o quarto texto a aparecer
//para adicionar mais texto apenas tem de escrever fcontent[x] x=numero seguinte, tendo uma sequencia de 0, 1, 2, 3, 4, 5, 6, 7, 8 , 9 , 10 e por ai a diante

closetag='';//fecha a begintag

var fwidth='500'; //define o valor da with
var fheight='500'; //define o valor da height

var fadelinks=1; //os links devem ter uma formatação igual ao texto? Se sim "1", se não "0"

//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//É favor não editar o código que se encontra para baixo de forma a não estragar o script
var ie4=document.all&&!document.getElementById;
var DOM2=document.getElementById;
var faderdelay=0;
var index=0;

function changecontent(){
if (index>=fcontent.length)
index=0
if (DOM2){
document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
if (fadelinks)
linkcolorchange(1);
colorfade(1, 15);
}
else if (ie4)
document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
index++
}

function linkcolorchange(step){
var obj=document.getElementById("fscroller").getElementsByTagName("A");
if (obj.length>0){
for (i=0;i<obj.length;i++)
obj[i].style.color=getstepcolor(step);
}
}

var fadecounter;
function colorfade(step) {
if(step<=maxsteps) {
document.getElementById("fscroller").style.color=getstepcolor(step);
if (fadelinks)
linkcolorchange(step);
step++;
fadecounter=setTimeout("colorfade("+step+")",stepdelay);
}else{
clearTimeout(fadecounter);
document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
setTimeout("changecontent()", delay);

}
}

function getstepcolor(step) {
var diff
var newcolor=new Array(3);
for(var i=0;i<3;i++) {
diff = (startcolor[i]-endcolor[i]);
if(diff > 0) {
newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
} else {
newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
}
}
return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}

if (ie4||DOM2)
document.write('<div id="fscroller"'+fwidth+';height:'+fheight+'"></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent
</script>
<!--FIM-->
</body>
</html>

Our lives begin to end the day we become silent about things that matter - Martin Luther King

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.