Skip to content

Commit a7bad44

Browse files
ww2497peterkos
andauthored
Highlighting nav items with scroll (#1064)
* Basic nav highlighting * Nav is now hidden on mobile again * Fixed conflicting smooth scrolling settings * Added transparency transition * Adjusted transition target * Adjusted transition target * Added a comment * Update sass/main.scss Co-authored-by: Peter Kos <[email protected]> * Restored old nav structure, adjusted scrolling * Searchbar no longer shows ID, fixed border unaligning nav items * Remove hover on click * Cleaned up CSS, added comment * Removed newline * Update package-lock.json * Update package-lock.json * Target navbar links instead of login button Co-authored-by: Peter Kos <[email protected]>
1 parent 36f3255 commit a7bad44

File tree

5 files changed

+1699
-999
lines changed

5 files changed

+1699
-999
lines changed

index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
</head>
2727
<body>
2828
<nav>
29-
<div class="left">
29+
<div class="left navbar-items">
3030
<a id="logo" href="https://brickhack.io">
3131
<img src="assets/logo.svg" alt="BrickHack 7 Logo" />
3232
</a>
33-
<a class="link" href="#hackathon-content">GENERAL</a>
34-
<a class="link" href="#faq">FAQ</a>
33+
<a class="link" href="#hackathon">GENERAL</a>
3534
<a class="link" href="#schedule">SCHEDULE</a>
35+
<a class="link" href="#faq">FAQ</a>
3636
<a class="link" href="#leadership">ABOUT US</a>
3737
</div>
3838
<div class="right">

index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ const comment = document.createComment("\n"+hiringMessage.toString()+"\n");
1616
document.insertBefore(comment, document.firstChild);
1717

1818

19+
// Nav highlighting on scroll
20+
import ActiveMenuLink from "active-menu-link";
21+
22+
let options = {
23+
itemTag: "",
24+
scrollOffset: -90, // nav height
25+
scrollDuration: 1000,
26+
ease: "out-quart",
27+
showHash: false,
28+
};
29+
30+
new ActiveMenuLink(".navbar-items", options);
31+
32+
1933
// Random hero SVG on each page load
2034
import desk1 from './assets/desk1.svg'
2135
import desk2 from './assets/desk2.svg'

0 commit comments

Comments
 (0)