- Grand-Mercredi

Fermer et retourner à l'article

function popinOeuf() { // OUVRIR LA POPIN } function montrerOeuf() { console.log("je suis un oeuf"); var oeufStyle = document.createElement('style'); oeufStyle.innerHTML = "@keyframes rouleoeuf{100%{transform:rotate(360deg);left:calc(50% - 60px)}}"; oeufStyle.innerHTML += "#oeufdepaque{ position:absolute;left:0px;bottom:0px;"; oeufStyle.innerHTML += "-webkit-animation-name:rouleoeuf;-webkit-animation-duration:4s;"; oeufStyle.innerHTML += "-webkit-animation-fill-mode: forwards;-webkit-animation-iteration-count:1;}"; document.head.appendChild(oeufStyle); ​ var img_oeuf = document.createElement("img"); img_oeuf.setAttribute("id", "oeufdepaque"); img_oeuf.setAttribute("src", "https://ggm-subdomains.s3.gra.io.cloud.ovh.net/grand-mercredi/medias/oeuf_fondation_de_france.png"); img_oeuf.setAttribute("width", "120"); //original = 207 img_oeuf.setAttribute("height", "auto"); // original = 277 img_oeuf.setAttribute("alt", "Oeuf de Paques de Grand-Mercredi"); img_oeuf.setAttribute("onclick", "popinOeuf()"); document.body.appendChild(img_oeuf); } document.addEventListener('DOMContentLoaded', (event) => { let frequenceoeuf = 5; let tirage = Math.ceil(Math.random() * frequenceoeuf); console.log("avant oeuf"); if( tirage == 1 || true ) montrerOeuf(); console.log("apres oeuf"); })