Skip to content

Commit

Permalink
Added ScrollSpying to website.
Browse files Browse the repository at this point in the history
  • Loading branch information
Midlight25 committed Mar 24, 2021
1 parent a223644 commit 6c42e28
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ html(lang="en")
// Including web-manifest for Android devices
link(rel="manifest", href="./manifest.webmanifest")

body#pageTop.bg-light
body#pageTop.bg-light(data-bs-spy="scroll", data-bs-target="#navbarContent")
// Navigation - Side-bar nav on desktops, classic navbar on mobile.
nav#sideNav.navbar.navbar-expand-lg.navbar-dark.bg-primary.fixed-top.px-4
// The brand switches between my Profile Picture and my name, depending on what size the screen is at.
Expand Down
11 changes: 8 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict;'

// Importing Bootstrap Collapse.
// I'm not using any other components.
import { Collapse } from 'bootstrap';
// Importing Bootstrap Collapse and ScrollSpy
// Tree-shaking!
import { Collapse, ScrollSpy } from 'bootstrap';

console.log("Modules Loaded");

Expand All @@ -13,3 +13,8 @@ let collapseList:Array<Collapse> = collapseElementList.map(function (collapseEl)
toggle: false
});
});

// Enabling ScrollSpy
let scrollSpyElements:ScrollSpy = new ScrollSpy(document.body, {
target: '#navbarContent'
});
1 change: 1 addition & 0 deletions src/scss/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
body {
padding-top: 3.75rem;
color: $gray-600;
position: relative;
}

// Change body alignment setup to use side nav bar.
Expand Down

0 comments on commit 6c42e28

Please sign in to comment.