-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo9.html
More file actions
87 lines (77 loc) · 1.65 KB
/
demo9.html
File metadata and controls
87 lines (77 loc) · 1.65 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<html>
<head>
<meta charset="UTF-8">
<title>Top Layer:トーストとモーダルの重なり順</title>
<style>
body {
font-family: sans-serif;
}
.controls {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
dialog {
padding: 32px;
border: 1px solid #ccc;
max-width: 380px;
}
dialog::backdrop {
background: rgb(0 0 0 / 0.4);
}
@keyframes toast-in {
from {
opacity: 0;
transform: translateY(8px);
}
to {
opacity: 1;
transform: none;
}
}
#toast {
position: fixed;
inset: unset;
bottom: 1.5rem;
right: 1.5rem;
background: #2c3e50;
color: white;
padding: 0.75rem 1.25rem;
border: none;
margin: 0;
font-size: 0.9rem;
animation: toast-in 0.3s ease;
}
.note {
margin-top: 1rem;
font-size: 0.85rem;
color: #666;
}
</style>
</head>
<body>
<div class="controls">
<button onclick="showToast()">①トーストを表示</button>
<button onclick="modal9.showModal()">②モーダルを開く</button>
</div>
<p class="note">
手順:①「トーストを表示」→ ②「モーダルを開く」でトーストが背面に潜る。
</p>
<dialog id="modal9">
<p>モーダルが開いています。</p>
<p>トーストは Top Layer の背面に潜り込んでいます。</p>
<button autofocus onclick="modal9.close()">閉じる</button>
</dialog>
<div id="toast" popover="manual">🔔 通知:処理が完了しました</div>
<script>
function showToast() {
const toast = document.getElementById('toast');
if (toast.matches(':popover-open')) toast.hidePopover();
toast.showPopover();
setTimeout(() => {
if (toast.matches(':popover-open')) toast.hidePopover();
}, 4000);
}
</script>
</body>
</html>