-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo3.html
More file actions
53 lines (46 loc) · 1.1 KB
/
demo3.html
File metadata and controls
53 lines (46 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<html>
<head>
<meta charset="UTF-8">
<title>閉じるときのアニメーション(transition-behavior: allow-discrete)</title>
<style>
body {
font-family: sans-serif;
}
dialog {
padding: 32px;
border: 1px solid #ccc;
max-width: 320px;
transition-property: opacity, transform, display, overlay;
transition-duration: .5s;
transition-behavior: allow-discrete;
@starting-style {
opacity: 0;
transform: scale(0.9);
}
}
dialog:not([open]) {
opacity: 0;
transform: scale(.9);
}
dialog::backdrop {
background: rgb(0 0 0 / 0.4);
transition-property: display, overlay, background-color;
transition-duration: .5s;
transition-behavior: allow-discrete;
@starting-style {
background-color: rgb(0 0 0 / 0);
}
}
dialog:not([open])::backdrop {
background-color: rgb(0 0 0 / 0);
}
</style>
</head>
<body>
<button onclick="modal3.showModal()">モーダルを開く</button>
<dialog id="modal3">
<p>開閉にアニメーションがあります(<code>transition-behavior: allow-discrete</code>)。</p>
<button onclick="modal3.close()">閉じる</button>
</dialog>
</body>
</html>