-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
57 lines (48 loc) · 1.75 KB
/
test.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
layout: default
---
<div class="kmdc-blog__posts mdc-layout-grid__inner barba-container" data-namespace="home">
</div>
<button id="kmdc-menu-button" class="mdc-button mdc-button--raised demo-button demo-button--normal">test</button>
<div id="kmssdc-menu" class="mdc-menu" style="position: absolute;" tabindex="-1">
<ul class="mdc-menu__items mdc-list" role="menu" aria-hidden="true">
<li class="mdc-list-item" role="menuitem" tabindex="0">
A Menu Item
</li>
<li class="mdc-list-item" role="menuitem" tabindex="0">
Another Menu Item
</li>
</ul>
</div>
<div id="toolbar" class="toolbar mdc-menu-anchor">
<div id="kmdc-menu" class="mdc-menu">
<ul class="mdc-menu__items mdc-list" role="menu" aria-hidden="true">
<li class="mdc-list-item" role="menuitem" tabindex="0">
A Menu Item
</li>
<li class="mdc-list-item" role="menuitem" tabindex="0">
Another Menu Item
</li>
</ul>
</div>
</div>
<script>
// document.addEventListener("DOMContentLoaded", function (event) {
// Instantiation
var menuEl = document.querySelector('#kmdc-menu');
var menu = new mdc.menu.MDCMenu(menuEl);
var menuButtonEl = document.querySelector('#kmdc-menu-button');
// Toggle menu open
menuButtonEl.addEventListener('click', function () {
menu.open = !menu.open;
});
// Listen for selected item
menuEl.addEventListener('MDCMenu:selected', function (evt) {
var detail = evt.detail;
});
// Set Anchor Corner to Bottom End
menu.setAnchorCorner(mdc.menu.MDCMenuFoundation.Corner.BOOTOM_END);
// Turn off menu open animations
menu.quickOpen = false;
// });
</script>