From 55dc2ab48cdc4414791c099f8779b03acd353ef7 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Wed, 25 Jun 2025 18:29:33 -0400 Subject: [PATCH] New scroll to top button and functions. --- .../(idaa)/recovery_meetings/+page.svelte | 34 ++++ .../ae_idaa_comp__event_obj_li.svelte | 15 +- src/routes/idaa/+layout.svelte | 163 +++++++++++++++++- 3 files changed, 204 insertions(+), 8 deletions(-) diff --git a/src/routes/idaa/(idaa)/recovery_meetings/+page.svelte b/src/routes/idaa/(idaa)/recovery_meetings/+page.svelte index 2abfe871..d8c589bb 100644 --- a/src/routes/idaa/(idaa)/recovery_meetings/+page.svelte +++ b/src/routes/idaa/(idaa)/recovery_meetings/+page.svelte @@ -401,6 +401,36 @@ function add_activity_log( log_lvl: log_lvl }); } + +// let hide_scroll_btn = $state(true); // This is to hide the scroll to top button initially +// let scroll_y = $state(75); + +// function go_top() { +// document.body.scrollIntoView(); +// } + +// function scroll_container() { +// console.log('Element', document.getElementById('ae_idaa__recovery_meetings')) +// return document.getElementById('ae_idaa__recovery_meetings') || document.documentElement || document.body; +// // return document.documentElement || document.body; +// } + +// function handle_on_scroll() { +// if (!scroll_container()) { +// return; +// } +// console.log(`Scroll position: ${scroll_container().scrollTop}`); + +// let show_on_px = 500; // The scroll position at which the button will be shown + +// if (scroll_container().scrollTop > show_on_px) { +// hide_scroll_btn = false; +// } else { +// hide_scroll_btn = true; +// } +// } + + @@ -413,6 +443,7 @@ function add_activity_log( +
show_on_px) { +// hide_scroll_btn = false; +// } else { +// hide_scroll_btn = true; +// } +// } + +$effect(() => { + // console.log(`idaa_root_layout.svelte`); + // if (scroll_y) { + // console.log(`Scroll position: ${scroll_y}`); + // // handle_on_scroll(); + // } + + // if (yTop) { + // console.log(`Scroll container top diff: ${yTop}`); + // } + + // else { + // hide_scroll_btn = true; // Hide the button if scroll_y is 0 + // } + // if (log_lvl > 1) { + // console.log(`idaa_root_layout.svelte: data:`, data); + // } + + // // If the browser is Safari, we need to handle the scroll differently + // if (is_safari) { + // console.log('Safari detected, using special scroll handling'); + // // Add any Safari-specific logic here if needed + // } + + // // Initial scroll position + // scroll_y = scroll_container().scrollTop; + + // // Set up the scroll event listener + // window.addEventListener('scroll', () => { + // scroll_y = scroll_container().scrollTop; + // handle_on_scroll(); + // }); +}); @@ -104,14 +188,13 @@ function add_activity_log( IDAA - {$idaa_loc?.title ?? 'Æ loading...'} - + +
@@ -215,3 +298,69 @@ function add_activity_log(
+ + + \ No newline at end of file