Want to make creations as awesome as this one?

Transcript

tirage

SUSPENS

RND

de

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

version 2.21

30/09/2020

Nouvelle version avec PIOCHE (tirage de cartes)

Réutilisez !

Extension proposée par Patrice Nadam

tirage

PIOCHE

tirage

Lancement automatique

Lancement automatique sans suspense

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

Objet à grouper avec un élément Genially(dos de carte, zone transparente...)

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>

PIOCHE

tirage

SUSPENS

Page pour votre création

tirage5

tirage7

tirage8

tirage1

tirage4

tirage3

tirage

tirage2

tirage6

tirage9

SUSPENS2

SUSPENS6

SUSPENS6

SUSPENS

SUSPENS1

SUSPENS4

SUSPENS3

SUSPENS5

SUSPENS7

SUSPENS9

SUSPENS8

Version avec 10 RND différents dans la même page

PIOCHE

PIOCHE

PIOCHE

PIOCHE

PIOCHE

PIOCHE

6 pioches différentes pouvant fonctionner dans la même page

tirage UNIQUE

Version avec 21 RND différents dans la même page activés par un seul bouton (non compatible avec les versions antérieures)

<div class="rnd20" datanum="20" data-rnd="hasard" style="font-size: 16px;width:100%; height:100%; background-color: lavender;text-align:center;">RND20 (cache-auto)</div> <script> </script>

Si besoin, script pour ajouter de nouveaux éléments RND - Penser à changer le numéro de la référence