-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodal.html
More file actions
48 lines (43 loc) · 1.12 KB
/
Copy pathmodal.html
File metadata and controls
48 lines (43 loc) · 1.12 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<style>
* {
box-sizing: border-box;
}
body {
margin: 2rem;
font-family: sans-serif;
}
</style>
<script src="modal.js"></script>
</head>
<body>
<uc-modal>
<h1 slot="title">Please Confirm</h1>
<p>Are you super sure?</p>
</uc-modal>
<p>Please confirm your choice.</p>
<button>Show Details & Confirm</button>
<script>
const confirmButton = document.querySelector('button')
const modal = document.querySelector('uc-modal')
modal.addEventListener('confirm', () => {
console.log('Confirmed...')
})
modal.addEventListener('cancel', () => {
console.log('Cancelled...')
})
confirmButton.addEventListener('click', () => {
if (!modal.isOpen) {
modal.open()
console.log('opening...')
}
})
</script>
</body>
</html>