fix swap
This commit is contained in:
parent
84dde04352
commit
8ed037123c
@ -64,26 +64,34 @@ import { Menu } from "lucide-astro";
|
|||||||
const navMobile = document.getElementById("nav-mobile")!;
|
const navMobile = document.getElementById("nav-mobile")!;
|
||||||
const navButtons = navMobile.children;
|
const navButtons = navMobile.children;
|
||||||
|
|
||||||
button.addEventListener("click", () => {
|
const init = () => {
|
||||||
if (navMobile.classList.contains("hidden")) {
|
button.addEventListener("click", () => {
|
||||||
animate(
|
if (navMobile.classList.contains("hidden")) {
|
||||||
navButtons as unknown as NodeListOf<any>,
|
animate(
|
||||||
{
|
navButtons as unknown as NodeListOf<any>,
|
||||||
y: [-30, 0],
|
{
|
||||||
scale: [0.8, 1],
|
y: [-30, 0],
|
||||||
opacity: [0, 1],
|
scale: [0.8, 1],
|
||||||
},
|
opacity: [0, 1],
|
||||||
{
|
},
|
||||||
easing: spring({
|
{
|
||||||
stiffness: 200,
|
easing: spring({
|
||||||
damping: 20,
|
stiffness: 200,
|
||||||
mass: 1,
|
damping: 20,
|
||||||
}),
|
mass: 1,
|
||||||
delay: stagger(0.1),
|
}),
|
||||||
},
|
delay: stagger(0.1),
|
||||||
);
|
},
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
|
||||||
navMobile.classList.toggle("hidden");
|
navMobile.classList.toggle("hidden");
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
init();
|
||||||
|
|
||||||
|
document.addEventListener("astro:after-swap", () => {
|
||||||
|
init();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user