-
Notifications
You must be signed in to change notification settings - Fork 20
/
index.html
89 lines (81 loc) · 2.58 KB
/
index.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
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>VanillaJS ScrollSpy</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">
<style>
html, body {
height: 100%;
}
.navbar-brand > .navbar-item {
font-size: 20px;
font-weight: bold;
}
.navbar-menu .navbar-item {
font-size: 14px;
transition: background-color .26s, color .26s;
}
.navbar-menu .navbar-item.active {
background-color: #222;
color: red;
}
.page {
height: 100%;
padding: 80px 0;
width: 100%;
}
.page:nth-child(odd) { background-color: #ddd; }
.page:nth-child(even) { background-color: #fff; }
</style>
</head>
<body>
<nav class="navbar is-dark is-fixed-top" role="navigation" aria-label="main navigation">
<div class="container">
<div class="navbar-brand">
<a title="VanillaJS ScrollSpy" class="navbar-item">VanillaJS ScrollSpy</a>
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="navbar" class="navbar-menu navbar-scroll">
<div class="navbar-start">
<a href="#home" title="Home" class="navbar-item active">Home</a>
<a href="#portfolio" title="Portfolio" class="navbar-item">Portfolio</a>
<a href="#about" title="About" class="navbar-item">About</a>
<a href="#contact" title="Contact" class="navbar-item">Contact</a>
</div>
</div>
</div>
</nav>
<section id="home" class="page">
<div class="container">
<h2 class="title">Home</h2>
</div>
</section>
<section id="portfolio" class="page">
<div class="container">
<h2 class="title">Portfolio</h2>
</div>
</section>
<section id="about" class="page">
<div class="container">
<h2 class="title">About</h2>
</div>
</section>
<section id="contact" class="page">
<div class="container">
<h2 class="title">Contact</h2>
</div>
</section>
<script src="../dist/vanillajs-scrollspy.min.js"></script>
<script>
const menu = document.querySelector('#navbar');
const scrollspy = VanillaScrollspy({ menu });
scrollspy.init();
</script>
</body>
</html>