Ver ❯
Herramientas SEO
Tamaño del resultado:
668 x 574
×
Cambiar Orientacion
Cambiar tema, Oscuro/Luz
<!doctype html> <html> <head> <title>Demostración de elemento - dialog</title> <meta name="viewport" content="-scalable=yes, initial-scale=1.0, width=device-width, maximum-scale=5"> </head> <body> <style> html { font-family: Helvetica, Arial, sans-serif; font-size: 100%; } h1 { margin-top: 0; } button { display: inline-block; border-radius: 3px; border: none; font-size: 0.9rem; padding: 1rem 0.8em; margin-bottom: 30px!important; margin-left: 30px!important; background: #69c773;width: auto; height: 50px; border-bottom: 1px solid #498b50; color: white; -webkit-font-smoothing: antialiased; font-weight: bold; margin: 0 0.25rem; text-align: center; } button:hover, button:focus { opacity: 0.75; cursor: pointer; } button:active { opacity: 1; box-shadow: 0 -3px 10px rgba(0, 0, 0, 0.1) inset; } #styledModal { background: #FFF; width: 300px; text-align: center; padding: 1.5em; margin: 1em auto; border: 0; border-top: 5px solid #69c773; box-shadow: 0 2px 10px rgba(0,0,0,0.8); } #styledModal::backdrop { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.8); }#page-wrapper { margin-top: 50px; } </style> <div id="page-wrapper"> <button id="launchDialog">Diálogo de inicio</button> <button id="launchModal">Modo de lanzamiento</button> <button id="launchStyledModal">Modal con estilo de lanzamiento</button> </div> <dialog id="dialog"> <p>¡Hola, soy un diálogo!</p> <button class="close">Okay</button> </dialog> <dialog id="modal"> <p>Hola soy modal!</p> <button class="close">Okay</button> </dialog> <dialog id="styledModal"> <p>Hola, soy una modal de estilo!</p> <button class="close">Okay</button> </dialog> <script> window.onload = function () { // Get the buttons. var dialogBtn = document.getElementById('launchDialog'); var modalBtn = document.getElementById('launchModal'); var styledModalBtn = document.getElementById('launchStyledModal'); var closeBtns = document.querySelectorAll('.close'); // Get the dialogs. var dialog = document.getElementById('dialog'); var modal = document.getElementById('modal'); var styledModal = document.getElementById('styledModal'); // Setup Event Listeners dialogBtn.addEventListener('click', function(e) { e.preventDefault(); dialog.show(); }); modalBtn.addEventListener('click', function(e) { e.preventDefault(); modal.showModal(); }); styledModalBtn.addEventListener('click', function(e) { e.preventDefault(); styledModal.showModal(); }); for (var i = 0; i < closeBtns.length; i++) { closeBtns[i].addEventListener('click', function(e) { this.parentNode.close(); }); } }; </script> </body> </html>