mirror of
https://github.com/emailerfacu-spec/minix-front.git
synced 2026-04-28 17:22:47 -03:00
cocinado boton para volver arriba
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user