@AdrianoEscarabote
Posted
Salve lucas! Cara ficou ótimo ahahhahaha
Observei que você fez duas paginas para mudar os textos e emojis! Para simplificar mais poderiamos fazer com js, existem algumas formas de fazer isso, mas usaremos uma função no botão de mudar tema!
Primeiro adicionemos a propriedade on click, chamando a função cada vez que o usuário clicar nele.
<a class="btn-2" onclick="change()">👽 Change Color</a>
Agora criaremos a nossa funçaõ no js, mas primeiros adicionaremos alguns ids nos elementos que queremos manipular via js.
<li> <span id="emoji">👽</span> <span id="text">Tutorials by industry experts</span></li>
Com esses elementos conseguimos já conseguimos ter uma noção do que está acontecendo!
Para fazer a mudança dos textos e emojis usaremos a propriedade innerHTML
que basicamente funciona assim:
text.innerHTML = "ira mudar o conteudo que aparece no html, para o conteudo que estiver aqui dentro"
vai ficar assim:
let text = document.getElementById("text")
let emoji = document.getElementById("emoji")
function change() {
document.body.classList.toggle("light-theme")
if (document.body.classList.contains("light-theme")) {
emoji.innerHTML = "😔"
text.innerHTML = "Oi né"
} else {
text.innerHTML = "Testeeeeee"
emoji.innerHTML = "😁"
}
}
adicionei isso no css:
.light-theme {
--cyan-1: rgb(16, 22, 22);
--cyan-2: rgb(82, 77, 9);
--cyan-3: rgb(187, 77, 44);
}
espero que ajude man 👍
Marked as helpful
@correlucas
Posted
@AdrianoEscarabote Valeu! Depois dessa aula deu até vontade de aprender JS.