How can I fade in an HTML5 dialog? And by dialog I mean HTML5 <dialog>
tag (http://demo.agektmr.com/dialog/).
I tried the following (http://jsfiddle.net/v6tbW/) but for some reason the transition does not work.
HTML
<dialog id="myDialog">
Test
</dialog>
<script>
document.getElementById('myDialog').show(); // note that this is a method of <dialog>, this is not a jQuery method.
</script>
CSS
dialog {
position: absolute;
left: 0; right: 0;
margin: auto;
border: solid;
padding: 1em;
background: white;
color: black;
width: -moz-fit-content;
width: -webkit-fit-content;
width: fit-content;
height: -moz-fit-content;
height: -webkit-fit-content;
height: fit-content;
visibility:hidden;
opacity:0;
transition:visibility 10s linear 10s,opacity 10s linear;
}
dialog[open] {
visibility:visible;
opacity:1;
transition-delay:0s;
}
.backdrop {
position: fixed;
background: rgba(0,0,0,0.1);
top: 0;
bottom: 0;
left: 0;
right: 0;
}
-webkit-transition:visibility linear 10s, opacity linear 10s;
. – BalconyHTMLElement
instance that has ashow()
method. I think you mean to set the open attribute likeelement.setAttribute('open', 'open')
– Balcony