Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions assets/hb/modules/header/js/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "js/bootstrap/src/dropdown";
import "js/bootstrap/src/offcanvas";
import params from "@params";

(() => {
document.addEventListener('DOMContentLoaded', () => {
Expand Down Expand Up @@ -27,6 +28,18 @@ import "js/bootstrap/src/offcanvas";
nav.style.zIndex = '0';
}

const topOffset = () => {
const v = nav.clientHeight + parseInt(params.styles.hb_top_offset ?? 24)
document.body.style.setProperty(`--${params.styles.prefix}top-offset`, v + 'px')
}

if (params.header.sticky) {
topOffset()
window.addEventListener('resize', () => {
topOffset()
})
}

let h = 0;
const threshold = 20;
if (document.documentElement.scrollTop !== 0) {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ go 1.18

require (
github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2 v2.21100.20000 // indirect
github.com/hbstack/hb v0.6.0 // indirect
github.com/hbstack/hb v0.7.0 // indirect
github.com/hugomods/icons/vendors/bootstrap v0.5.0 // indirect
)
12 changes: 3 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2 v2.21100.20000 h1:GZxx4Hc+yb0/t3/rau1j8XlAxLE4CyXns2fqQbyqWfs=
github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2 v2.21100.20000/go.mod h1:mFberT6ZtcchrsDtfvJM7aAH2bDKLdOnruUHl0hlapI=
github.com/hbstack/hb v0.3.0 h1:GKsRjWEDh9pIZX4SMkopLC86RTzGQd2FSXXBof91lDQ=
github.com/hbstack/hb v0.3.0/go.mod h1:37E1uTMQx1Hix+VdwlWkW74fi3ct5+KlCCBywv9l3Ac=
github.com/hbstack/hb v0.4.0/go.mod h1:37E1uTMQx1Hix+VdwlWkW74fi3ct5+KlCCBywv9l3Ac=
github.com/hbstack/hb v0.5.0/go.mod h1:37E1uTMQx1Hix+VdwlWkW74fi3ct5+KlCCBywv9l3Ac=
github.com/hbstack/hb v0.5.1/go.mod h1:qlNnPNO1MRsrxxDvFMz98DMFafaBgvtAfBYiteR3i1A=
github.com/hbstack/hb v0.5.2/go.mod h1:S/08mx1tK6yxjQIkSqvpqG8HrBzMBDJq1WC5QjXW9p0=
github.com/hbstack/hb v0.6.0/go.mod h1:S/08mx1tK6yxjQIkSqvpqG8HrBzMBDJq1WC5QjXW9p0=
github.com/hbstack/hb v0.7.0 h1:z+pbW5pdDefLH5kJ13wDXSSjrOhcvNIiCNXv1ui7itc=
github.com/hbstack/hb v0.7.0/go.mod h1:S/08mx1tK6yxjQIkSqvpqG8HrBzMBDJq1WC5QjXW9p0=
github.com/hugomods/icons v0.6.0 h1:G6RU93okhPPRDh/jqcew9gwkcYpSpg0rCBv4S6yUAFw=
github.com/hugomods/icons/vendors/bootstrap v0.4.1 h1:E6yhi52RF2M7p7Z3nuubf77YC9PSUbWDAtqNFK4TfXE=
github.com/hugomods/icons/vendors/bootstrap v0.4.1/go.mod h1:3fXUsXdGZa+f31OEKUMDGsrCq1XZwhLvUys8XT63AZM=
github.com/hugomods/icons/vendors/bootstrap v0.5.0 h1:CHEGk677heq2kJZa7XsGHRc3Hwizl9NFkmNw146OVm0=
github.com/hugomods/icons/vendors/bootstrap v0.5.0/go.mod h1:kfC17VWV+tNi6PGF4AY7CJBBa1/HEgWxCYq2kNOdcdI=