File tree Expand file tree Collapse file tree 4 files changed +10
-2
lines changed Expand file tree Collapse file tree 4 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,15 @@ import {
6
6
Dropdown ,
7
7
DropdownItems ,
8
8
DropdownSubmenu ,
9
+ StickyHeader
9
10
} from " astro-navbar" ;
10
11
---
11
12
13
+ <StickyHeader
14
+ class =" sticky top-0 border-b z-20 transition-all"
15
+ scrollY ={ 40 }
16
+ defaultClass =" py-5 border-transparent"
17
+ activeClass =" py-2 bg-white/80 border-gray-200 backdrop-blur-lg" >
12
18
<header class =" lg:flex justify-between p-5 gap-5 mx-auto container" >
13
19
<Astronav closeOnClick >
14
20
<div class =" flex w-full lg:w-auto justify-between" >
@@ -217,3 +223,4 @@ import {
217
223
</MenuItems >
218
224
</Astronav >
219
225
</header >
226
+ </StickyHeader >
Original file line number Diff line number Diff line change @@ -6,4 +6,5 @@ import Layout from "./layout.astro";
6
6
<Layout >
7
7
<Navbar />
8
8
<h1 class =" text-center font-medium text-2xl mt-16" >Astro Nav Demo</h1 >
9
+ <div class =" m-40 mt-72 bg-pink-50" style =" height: 1500px;" ></div >
9
10
</Layout >
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " astro-navbar" ,
3
- "version" : " 2.3.2 " ,
3
+ "version" : " 2.3.3 " ,
4
4
"description" : " Responsive Mobile Navigation with Dropdown in Astro" ,
5
5
"type" : " module" ,
6
6
"exports" : " ./index.ts" ,
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ function OnScroll(scrollPos) {
34
34
header.setAttribute("active", "");
35
35
}
36
36
//reduce the scrollY to avoid flickering when scrolling up
37
- if (scrollPos < Math.max(scrollY - 20, 0 )) {
37
+ if (scrollPos < Math.max(scrollY - 40, 10 )) {
38
38
header.classList.remove("is-active", ...classArray);
39
39
header.classList.add(...replaceArray);
40
40
header.removeAttribute("active");
You can’t perform that action at this time.
0 commit comments