Skip to content

Commit

Permalink
make the left side menu sticky on scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
flynnduism committed Mar 5, 2019
1 parent 67040bb commit d229b2c
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
13 changes: 13 additions & 0 deletions docs/themes/techdoc-brigade/layouts/partials/footer.html
Expand Up @@ -9,3 +9,16 @@
<i class="fas fa-circle"></i>
<i class="fas fa-arrow-circle-up"></i>
</span></a>

<script type="text/javascript">
// make the sidebar sticky on scroll
var affixMenu = document.querySelector(".sidebar");

window.onscroll = function() {
if (window.pageYOffset > 140) {
affixMenu.classList.add("fixed");
} else {
affixMenu.classList.remove("fixed");
};
}
</script>
14 changes: 14 additions & 0 deletions docs/themes/techdoc-brigade/static/css/theme.css
Expand Up @@ -1021,6 +1021,20 @@ header nav ul li a {
color: #647b83;
}

.sidebar.fixed nav {
position: fixed;
max-width: 300px;
left: 0;
top: 0;
bottom: 0;
z-index: 1500;
overflow-y: scroll;
}

.sidebar.fixed nav ul {
padding-bottom: 0.667rem;
}

main {
padding-bottom: 0;
}
Expand Down

0 comments on commit d229b2c

Please sign in to comment.