mirror of
https://github.com/fadden/6502bench.git
synced 2025-01-05 23:30:20 +00:00
7c5a0dfdb8
A bit of Javascript was used to remove the hamburger icon when a page doesn't have a #sidenav. This worked when sidenav-incl was being loaded with jQuery load(), because that mechanism works asynchronously, and #sidenav was part of the DOM before it ran. Once we started merging HTML fragments directly into the pages, the script got called before #sidenav was defined, so the icon was always being removed. One solution would be to move the script to footer-incl.html, to follow the preferred practice of placing scripts at the bottom of the <body>. The better solution was to move the "no-sidenav" class from #main to <body>, so that all components can see it. This lets us use CSS rules to hide the icon.
19 lines
648 B
HTML
19 lines
648 B
HTML
<!-- top navigation bar contents -->
|
|
<nav>
|
|
<a id="topnav-home" href="/">HOME</a>
|
|
<a id="topnav-sgtutorial" href="/sgtutorial">SourceGen Tutorial</a>
|
|
<a id="topnav-menuicon" href="javascript:void(0);" class="icon" onclick="toggleSidenav()">
|
|
<i class="fa fa-bars"></i>
|
|
</a>
|
|
</nav>
|
|
<script>
|
|
// Sidenav toggle function.
|
|
//
|
|
// Use a jQuery function to toggle the sidenav bar. The initial state
|
|
// is undefined / inherited, so it will pop in and out as the screen
|
|
// resizes around the "large" breakpoint.
|
|
function toggleSidenav() {
|
|
$("#sidenav").toggle("fast");
|
|
}
|
|
</script>
|