-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4-example.html
40 lines (32 loc) · 1.53 KB
/
4-example.html
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
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Popover API - JavaScript - HelloCoding.de</title>
</head>
<body>
<button popovertarget="popover-element">Manuelles Ausführen</button>
<div id="popover-element" popover>
<h1>Popover mit Schließen Button</h1>
</div>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et
dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet
clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,
consetetur sadipscing elitr, <a href="">sed</a> diam nonumy eirmod tempor invidunt ut labore et dolore magna
aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
<script>
document.addEventListener('DOMContentLoaded', () => {
const popoverElement = document.getElementById('popover-element');
popoverElement.addEventListener('beforetoggle', (event) => {
console.log('beforetoggle', event);
});
popoverElement.addEventListener('toggle', (event) => {
console.log('toggle', event);
});
popoverElement.togglePopover();
});
</script>
</body>
</html>