Advertisement
Henzo09

EZZ JAVASCRIPT

Oct 18th, 2024 (edited)
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const imageLinks = [
  2.     'https://images8.alphacoders.com/767/767470.jpg',
  3.     'https://img.freepik.com/fotos-gratis/arte-digital-de-fundo-do-japao_23-2151546123.jpg',
  4.     'https://cdn.discordapp.com/attachments/1286701048605708288/1296954726855741503/image.png?ex=67142ab7&is=6712d937&hm=ab7615c3082d8d6072ee2d9bf8e4089c3551976ada816c050a9fcde60f24e329'
  5. ];
  6.  
  7. function changeBack() {
  8.     const randomIndex = Math.floor(Math.random() * imageLinks.length);
  9.  
  10.     // Corrigido: removeu espaços extras e usou o nome correto da variável CSS
  11.     document.documentElement.style.setProperty('--background', `url('${imageLinks[randomIndex]}')`);
  12. }
  13.  
  14. // Troca a imagem de fundo imediatamente
  15. changeBack();
  16.  
  17. // Configura para trocar a imagem a cada 30 segundos (30.000 milissegundos)
  18. setInterval(changeBack, 3);
  19.  
Tags: ezz
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement