Différences entre versions de « MediaWiki:Common.js »

De ɴon-ᴀ
Sauter à la navigation Sauter à la recherche
m
m
Ligne 11 : Ligne 11 :
 
     document.body.appendChild(snowflake);
 
     document.body.appendChild(snowflake);
  
     setTimeout(() => {
+
     /*setTimeout(() => {
 
       document.body.removeChild(snowflake);
 
       document.body.removeChild(snowflake);
 
     }, 5000);
 
     }, 5000);
 +
*/
 
   }
 
   }
  

Version du 21 janvier 2024 à 16:14

document.addEventListener('DOMContentLoaded', function () {
  console.log('hello');
  const snowflakes = ["❄", "❅", "❆"]; 

  function createSnowflake() {
    const snowflake = document.createElement('div');
    snowflake.className = 'snowflake';
    snowflake.innerHTML = snowflakes[Math.floor(Math.random() * snowflakes.length)];
    snowflake.style.left = Math.random() * window.innerWidth + 'px';
    snowflake.style.animationDuration = Math.random() * 3 + 2 + 's';
    document.body.appendChild(snowflake);

    /*setTimeout(() => {
      document.body.removeChild(snowflake);
    }, 5000);
*/
  }

  function generateSnowflakes() {
    setInterval(createSnowflake, 500); // Create a new snowflake every 500 milliseconds
  }

  generateSnowflakes();
});