wip
This commit is contained in:
+55
-1
@@ -101,7 +101,61 @@
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body {{if .ThemeClean}}class="theme-clean"{{end}}>
|
||||
<body {{if .ThemeClean}}class="theme-clean"{{end}}
|
||||
_="init
|
||||
set :lastScroll to 0
|
||||
set :scrollThreshold to 100
|
||||
set :keepHeaderVisible to false
|
||||
|
||||
on scroll from window
|
||||
set currentScroll to window.pageYOffset
|
||||
set isMenuOpen to .navigation-menu.classList.contains('menu-open')
|
||||
|
||||
-- Calculate if at bottom (within 50px)
|
||||
set scrollHeight to document.documentElement.scrollHeight
|
||||
set clientHeight to document.documentElement.clientHeight
|
||||
set isAtBottom to (scrollHeight - currentScroll - clientHeight) < 50
|
||||
|
||||
-- Reset keepHeaderVisible when scrolling up
|
||||
if currentScroll < :lastScroll
|
||||
set :keepHeaderVisible to false
|
||||
end
|
||||
|
||||
-- Header visibility based on scroll direction
|
||||
if currentScroll > :scrollThreshold
|
||||
if currentScroll > :lastScroll and not :keepHeaderVisible
|
||||
-- Scrolling down - hide header
|
||||
add .header-hidden to .action-bar
|
||||
if isMenuOpen then add .header-hidden to .navigation-menu end
|
||||
else
|
||||
-- Scrolling up - show header
|
||||
remove .header-hidden from .action-bar
|
||||
if isMenuOpen then remove .header-hidden from .navigation-menu end
|
||||
end
|
||||
else
|
||||
-- At top - always show header
|
||||
remove .header-hidden from .action-bar
|
||||
if isMenuOpen then remove .header-hidden from .navigation-menu end
|
||||
end
|
||||
|
||||
-- Back to top button visibility (show after 300px scroll)
|
||||
if currentScroll > 300
|
||||
set #back-to-top's *display to 'flex'
|
||||
else
|
||||
set #back-to-top's *display to 'none'
|
||||
end
|
||||
|
||||
-- At-bottom positioning for fixed buttons
|
||||
if isAtBottom
|
||||
add .at-bottom to #back-to-top
|
||||
add .at-bottom to #info-button
|
||||
else
|
||||
remove .at-bottom from #back-to-top
|
||||
remove .at-bottom from #info-button
|
||||
end
|
||||
|
||||
-- Update last scroll position
|
||||
set :lastScroll to currentScroll">
|
||||
<!-- Top anchor for back-to-top link -->
|
||||
<div id="top"></div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user