Want to make creations as awesome as this one?

Transcript

tirage

SUSPENS

RND

version 1.1

de

Réutilisez!

Testez

356x11

9x56

33+77

38+7

18-9

3+7

1/3+1/7

3:7

132+56

336-87

7-3

35+79

178415+1

3

7

tirage

tirage

tirage

Le dé cortiqué

Six faces superposées avec le bouton tirage placé au premier plan et rendu transparent

Chaque face est un groupe constitué d'un cadre, d'un ensemble de cercles, d'un fond et de l'objet "hasard"

La fonction"cache" a été supprimée

Fonction facultative qui cache les objets à l'ouverture de la page

Le dupliquer autant de fois que nécessaire...

Objet à grouper avec un élément Genially

Boutons au choix avec ou sans effet suspens

Le tuto

Le CODE

pour comprendre ou le plaisir des yeux

<script> //CACHE FENETRE AU CLIC setTimeout(function(){document.getElementsByClassName('icon-close')[0].click()}, 10); document.getElementById('genially-view-modal').style.visibility = "hidden"; //DEFINIT VARIABLES var hsrd = document.querySelectorAll(".hasard"); var idInterval var fois = 1; var lance=0; var valeur; var avoir; var acacher; //FONCTION LANCE AUTRE FONCTION TOUTES LES 150 ms function lancer(){ if (lance==0){ lance=1 idInterval = setInterval(tourne, 150); } else {return false; } } //FONCTION QUI AFFICHE TEMPORAIREMENT ET ALEATOIREMENT function tourne() { // CACHE TOUT for (var i = 0; i < hsrd.length; i++) { acacher=hsrd[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; if (acacher.getAttribute("id")==null) { acacher=hsrd[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; } acacher.style.visibility="hidden"; } // SORT UN CHIFFRE AU HASARD ET AFFICHE OBJET CORRESPONDANT valeur=Math.floor(Math.random() * hsrd.length); avoir=hsrd[valeur].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; if (avoir.getAttribute("id")==null) { avoir=hsrd[valeur].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; } avoir.style.visibility="visible"; // INCREMENT FOIS SI 20 TOURS ALORS RENITIALISE fois ++; if (fois == 20) { clearInterval(idInterval); fois=1; lance=0; } } lancer(); //FONCTION LANCER </script>

<div class="hasard">hasard</div> <script></script>

<div>Cache</div> <script> var url = window.location.pathname.split( "/" ); var refgenial= url[1]; if (refgenial!="editor") { function cache(){ var hsrd = document.querySelectorAll(".hasard"); for (var i = 0; i < hsrd.length; i++) { var acacher=hsrd[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; if (acacher.getAttribute("id")==null) { acacher=hsrd[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; } acacher.style.visibility="hidden"; } } cache(); } </script>

tirage

SUSPENS

tirage5

tirage7

tirage8

tirage1

tirage4

tirage3

tirage

tirage2

tirage6

tirage9

SUSPENS2

SUSPENS6

SUSPENS

SUSPENS1

SUSPENS4

SUSPENS3

SUSPENS5

SUSPENS7

SUSPENS9

SUSPENS8

tirage1

tirage

tirage9

tirage2

tirage4

tirage8

tirage3

tirage7

tirage6

tirage5

SUSPENS9

SUSPENS7

SUSPENS6

SUSPENS5

SUSPENS8

SUSPENS1

SUSPENS2

SUSPENS

SUSPENS3

SUSPENS4

page en cours de test