-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.html
More file actions
91 lines (80 loc) · 2.27 KB
/
example.html
File metadata and controls
91 lines (80 loc) · 2.27 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
88
89
90
91
<html>
<head>
<style>
body {
font-family: 'Open Sans', sans-serif;
}
ul {
position: absolute;
width: 20%;
left: 0;
top: 0;
margin: 0;
padding: 0;
}
li {
position: relative;
margin: 0;
display: block;
height: 20px;
padding: 5px;
text-align: center;
background-color: #2a6496;
color: #ffffff;
border-bottom: 1px solid #269abc;
}
.content-area {
position: absolute;
top: 0;
left: 20%;
width: 80%;
height:90%;
background-color:#f9f2f4;
visibility: hidden;
}
.content-area h1 {
font-size: 76px;
font-weight: bold;
text-align: center;
margin-top: 30%;
}
</style>
</head>
<body>
<ul>
<li href="#content-area-1">Menu Item 1</li>
<li href="#content-area-2">Menu Item 2</li>
<li href="#content-area-3">Menu Item 3</li>
<li href="#content-area-4">Menu Item 4</li>
</ul>
<div id="content-area-1" class="content-area"><h1>Content Area 1</h1></div>
<div id="content-area-2" class="content-area"><h1>Content Area 2</h1></div>
<div id="content-area-3" class="content-area"><h1>Content Area 3</h1></div>
<div id="content-area-4" class="content-area"><h1>Content Area 4</h1></div>
<script src="../src/intent.js"></script>
<script>
var menuItems = document.getElementsByTagName("li"),
contentAreas = document.getElementsByClassName("content-area"),
waitForIntent = false;
for (var i in menuItems) {
if (typeof menuItems[i] !== "object") { continue; }
menuItems[i].addEventListener("mousemove", function() {
var menuItem = this,
contentId = menuItem.getAttribute("href").replace("#",""),
contentArea = document.getElementById(contentId);
if (!waitForIntent) {
waitForIntent = true;
Intent(menuItem, contentArea, { debug: true }).watch().then(function() {
waitForIntent = false;
});
for (var i in contentAreas) {
if (typeof contentAreas[i] !== "object") { continue; }
contentAreas[i].style.visibility = "hidden";
}
document.getElementById(contentId).style.visibility = "visible";
}
});
}
</script>
</body>
</html>