Skip to content

gnat/html-dialog-animated-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Modern animated HTML Dialog in 2022

Minimalist, <dialog> example, keeping it simple.

References

Adam Argyle / argyleink from Google, extended Dialog Tutorial (2022)

Adam Argyle's Dialog Tutorial

Source (demo.html)

<!DOCTYPE html>
<html lang="en">
	<head>
		<style>
		dialog {
			display: grid;
			position: absolute;
			top: 0;
			right: 0;
			left: 0;
			margin: 0 auto;
			transition: all 2s;
		}
		dialog:not([open])  {
			animation: slideout 2s forwards;
			pointer-events: none;
			opacity: 0;
		}
		dialog[open] {
			animation: slidein 2s forwards;
		}
		@keyframes slidein {
			0% { margin-top: -10vh; }
			100% { margin-top: 10vh; }
		}
		@keyframes slideout {
			0% { margin-top: 10vh; }
			100% { margin-top: -10vh; }
		}
		</style>
	</head>
	<body>
		<dialog>
			Hello World
			<button onclick="document.querySelectorAll('dialog')[0].close()">Close</button>
		</dialog>
		<button onclick="document.querySelectorAll('dialog')[0].showModal()">Open Dialog</button>
	</body>
</html>

About

Minimalist animated HTML <dialog> element / tag demo.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages