Te mandare el codigo de mi pagina HTML CSS body { margin: 0; padding: 0; font-family:…
- User
Te mandare el codigo de mi pagina HTML
CSS
body { margin: 0; padding: 0; font-family: Arial, sans-serif;
}
.tick-mark-container { position: absolute; top: 0; left: 0; width: 50px; height: 50px; display: none; }
.container { z-index: 0; background-color: rgb(36, 36, 36); background-size: 100%; display: flex; flex-direction: row; height: 100vh; justify-content: center; align-items: center; }
.logo { z-index: 3; background-image: url(Logo.png); background-position: center; background-repeat: no-repeat; background-size: contain; width: 14%; height: 14%; position: absolute; top: 10; left: 10; }
.left-option p, .right-option p { text-align: justify; }
.left-option { z-index: 2; margin-right: 5px; display: flex; justify-content: center; align-items: center; width: 100%; height: 92%; background-image: url(Azul2.jpg); background-size: cover; color: #fff; font-size: 200%; font-weight: bold; padding: 2rem; cursor: pointer; display: flex; justify-content: center; align-items: center; }
.right-option { z-index: 2; margin-left: 5px; display: flex; justify-content: center; align-items: center; width: 100%; height: 92%; background-image: url(Rojo2.jpg); background-size: cover; color: #fff; font-size: 200%; font-weight: bold; padding: 2rem; cursor: pointer; display: flex; justify-content: center; align-items: center; }
.left-option, .right-option { text-shadow: 1px 1px 1px rgba(0,0,0,0.3); }
.left-option:hover { background-image: url('Azul.jpg'); background-size: cover; }
.right-option:hover { background-image: url('Rojo.jpg'); background-size: cover; }
.rectangle { position:absolute; top: 10; left: 0; width: 100%; height: 50%; background-color: rgba(46, 46, 46, 0.7); z-index: 1; }
JAVASCRIPT const questions = [ { left: 'Comer caca con sabor a chocolate', right: 'Comer chocolate con sabor a caca' }, { left: 'Tener el poder de volar', right: 'Tener el poder de ser invisible' } ];
const container = document.querySelector('.container'); const leftOption = document.querySelector('.left-option'); const rightOption = document.querySelector('.right-option');
function getRandomQuestion() { const randomIndex = Math.floor(Math.random() * questions.length); return questions[randomIndex]; }
function showRandomQuestion() { const question = getRandomQuestion(); leftOption.innerText = question.left; rightOption.innerText = question.right; }
showRandomQuestion();
leftOption.addEventListener('click', showRandomQuestion); rightOption.addEventListener('click', showRandomQuestion);
Bien, quiero hacer que la persona al tocar una opcion sobre la pregunta, quiero que le salgan los porcentajes GLOBALES de la gente que voto, por ejemplo, voto "Tener el poder de volar" entonces quiero que me salga el porcentaje de esa opcion y de la otra de la gente que voto y luego de 4 segundos cambiar a la siguientes opciones. Que cada porcentaje este separado de las otras opciones. Explica paso por paso y el codigo y haz que el porcentaje se guarde cuando una persona cualquiera vote, asi las opciones son globales, y lo quiero hacer gratis. Que sea online. Y haz que por ejemplo cuando me salga que prefieres: "Tener el poder de volar" o "Tener el poder de ser invisible" yo elija una, me aparezca el porcentaje de las 2 y en unos segundos cambie a otras opciones y el porcentaje sea distinto.
- Assistant