-3
I have the following title:
<h1>LANÇAMENTO: <span class="verde">PS5</span> E <span class="verde">XBOX SERIE S</span></h1>
In css I change the color of the span part. I have the following javascript function to change the text:
function trocaTituto(){
var titulo = $('.hero h1')
var textos = ["CONFIRA NOSSAS NOVIDADES", "LANÇAMENTO: PS5 E XBOX SERIE S"]
let position = 0
setInterval(() => {
//efeito de desaparecer
$(titulo).fadeOut(function() {
//função "callback" que mostra o próximo texto
if (position >= textos.length) position = 0;
$(titulo).text(textos[position++]).fadeIn();
});
}, 5000);
}
How do I put the green text back to the first part?
I have an H1 with some span inside, so some words will be white and others green. This function keeps alternating the text of this H1, but I can’t get it to switch with words of different colors, or it turns all white or all green.
– Johann Arouca
can you share html code? that then I can help you better
– Salguod
That’s it here <div class="banner" id="banner"> <Section class="Hero Section"> <H1> RELEASE: <span id="verde1" class="green">PS5</span> E <span id="Verde2" class="green">XBOX SERIES S</span> </H1> <a href="#historia" class="btn-banner">Learn more</a> </Section> </div>
– Johann Arouca
in case I change this H1, I can change the whole H1, but not the span that make some words stay of other colors
– Johann Arouca