JSFiddle - React, Tailwind, and code Playground
HTML
<div id="dialogoverlay"></div>
<div id="dialogbox">
<div>
<div id="dialogboxhead"></div>
<div id="dialogboxbody"></div>
<div id="dialogboxfoot"></div>
</div>
</div>
<section>
<header>Título</header>
<h2>Título 2</h2>
<p>Texto...</p>
<div class="pregunta" id="pregunta_1">
<h3>Pregunta 1</h3>
<ul>
<li><input type="radio" onclick="Alert.render('Respuesta 1')" >a. Respuesta</li>
<li><input type="radio" onclick="Alert.render('Respuesta 2')" >b. Respuesta</li>
<li><input type="radio" onclick="Alert.render('Respuesta 3')" >c. Respuesta</li>
<li><input type="radio" onclick="Alert.render('Respuesta 4')" >d. Respuesta</li>
</ul>
</div>
<div class="pregunta" id="pregunta_2" style="display:none;">
<h3>Pregunta 2</h3>
<ul>
<li><input type="radio" onclick="Alert.render('Respuesta 1')" >a. Respuesta</li>
<li><input type="radio" onclick="Alert.render('Respuesta 2')" >b. Respuesta</li>
<li><input type="radio" onclick="Alert.render('Respuesta 3')" >c. Respuesta</li>
<li><input type="radio" onclick="Alert.render('Respuesta 4')" >d. Respuesta</li>
</ul>
</div>
<div class="pregunta" id="pregunta_3" style="display:none;">
<h3>Pregunta 3</h3>
<ul>
<li><input type="radio" onclick="Alert.render('Respuesta 1')" >a. Respuesta</li>
<li><input type="radio" onclick="Alert.render('Respuesta 2')" >b. Respuesta</li>
<li><input type="radio" onclick="Alert.render('Respuesta 3')" >c. Respuesta</li>
<li><input type="radio" onclick="Alert.render('Respuesta 4')" >d. Respuesta</li>
</ul>
</div>
<div class="boton_avanzar" id="avanzar" style="display:none;" onClick="mostrar();">Siguiente pregunta</div>
</section>
CSS
html, body {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
#dialogoverlay {
display: none;
opacity: .6;
position: fixed;
top: 0px;
left: 0px;
background: #000000;
width: 100%;
z-index: 10;
}
#dialogbox {
display: none;
position: fixed;
background: #000;
border-radius:7px;
width:550px;
margin: 65px 0 0 0;
z-index: 10;
}
#dialogbox > div {
background:#FFF;
margin: 8px;
}
#dialogbox > div > #dialogboxhead {
font-family: Helvetica,Arial,sans-serif;
font-size:19px;
color:#CCC;
padding:10px;
}
#dialogbox > div > #dialogboxbody {
font-family: Helvetica,Arial,sans-serif;
padding: 5px;
color: #000;
}
#dialogbox > div > #dialogboxfoot {
font-family: Helvetica,Arial,sans-serif;
padding: 10px;
text-align: right;
}
/* MEDIA QUERY */
@media all and (max-width: 780px) {
header {
font-family: Helvetica,Arial,sans-serif;
font-size: 25px !important;
color: #008BDB;
font-weight: bold;
line-height: 25px;
text-align: left;
margin: 0 auto 20px auto;
background-color: #FF0000;
}
h1 {
font-size: 25px;
margin: 0 0 20px;
color: #000000;
line-height: 25px;
text-align: left;
}
section {
font-family: Helvetica,Arial,sans-serif;
font-size: 15px;
color: #000000;
line-height: 20px;
text-align: justify;
width: 90% !important;
height: auto;
margin: 0 auto;
padding: 15px;
background-color: #FFDD00;
/*para Firefox*/
-moz-border-radius: 15px 15px 15px 15px;
/*para Safari y Chrome*/
-webkit-border-radius: 15px 15px 15px 15px;
/* para Opera */
border-radius: 15px 15px 15px 15px;
/* Sombra */
-webkit-box-shadow: 10px 10px 15px 0px rgba(0,0,0,0.25);
-moz-box-shadow: 10px 10px 15px 0px rgba(0,0,0,0.25);
box-shadow: 10px 10px 15px 0px rgba(0,0,0,0.25);
}
/* Boton avanzar */
.boton_avanzar {
font-family: Helvetica,Arial,sans-serif;
font-size: 15px;
color: #FFFFFF;
text-align: center;
line-height: 50px;
text-decoration: none;
width:...
JavaScript
function CustomAlert(){
this.render = function(dialog){
var winW = window.innerWidth;
var winH = window.innerHeight;
var dialogoverlay = document.getElementById('dialogoverlay');
var dialogbox = document.getElementById('dialogbox');
dialogoverlay.style.display = "block";
dialogoverlay.style.height = winH+"px";
dialogbox.style.left = (winW/2) - (550 * .5)+"px";
dialogbox.style.top = "100px";
dialogbox.style.display = "block";
document.getElementById('dialogboxbody').innerHTML = dialog;
document.getElementById('dialogboxfoot').innerHTML = '<button class="cerrar_lightbox" onclick="Alert.ok()">OK</button>';
}
this.ok = function(){
document.getElementById('dialogbox').style.display = "none";
document.getElementById('dialogoverlay').style.display = "none";
//Ocultamos y ponemos visible
pregunta_1.style.display="none";
avanzar.style.display="block";
}
}
var Alert = new CustomAlert();
function mostrar(){
document.getElementById('pregunta_2').style.display='block';
document.getElementById('pregunta_3').style.display='block';
avanzar.style.display="none";
}
function ocultar(){
document.getElementById('pregunta_2').style.display='none';
document.getElementById('pregunta_3').style.display='none';
}