cocinado boton para volver arriba

This commit is contained in:
2026-02-04 21:30:34 -03:00
parent 5b5f82c0d6
commit 826d6478d7
3 changed files with 46 additions and 3 deletions
@@ -0,0 +1,16 @@
export class MostrarVolver {
scrollY = $state(0);
value = $derived(this.scrollY > 500);
constructor() {
if (typeof window !== 'undefined') {
$effect(() => {
const handleScroll = () => {
this.scrollY = window.scrollY;
};
window.addEventListener('scroll', handleScroll);
return () => window.removeEventListener('scroll', handleScroll);
});
}
}
}