Skip to content

Commit 086336d

Browse files
committed
feat: add shadow to the header if the body is scrolled
1 parent 7e18245 commit 086336d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/pug/_partials/scripts.pug

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
script(src='node_modules/@coreui/coreui/dist/js/coreui.bundle.min.js')
33
script(src='node_modules/simplebar/dist/simplebar.min.js')
44

5+
script.
6+
const header = document.querySelector('header.header');
7+
8+
document.addEventListener('scroll', () => {
9+
if (header) {
10+
header.classList.toggle('shadow-sm', document.documentElement.scrollTop > 0);
11+
}
12+
});
13+
514
block scripts
615

716
script

0 commit comments

Comments
 (0)