New scroll to top button and functions.

This commit is contained in:
Scott Idem
2025-06-25 18:29:33 -04:00
parent c947e9e77a
commit 55dc2ab48c
3 changed files with 204 additions and 8 deletions

View File

@@ -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;
// }
// }
</script>
@@ -413,6 +443,7 @@ function add_activity_log(
</svelte:head>
<div
class="
ae_idaa__recovery_meetings
@@ -617,3 +648,6 @@ function add_activity_log(
</Modal>

View File

@@ -179,7 +179,20 @@ function add_activity_log(
$idaa_sess.recovery_meetings.show__modal_view = true;
$idaa_sess.recovery_meetings.show__modal_view__event_id = idaa_event_obj?.event_id;
$idaa_sess.recovery_meetings.show__modal_edit = false;
$idaa_sess.recovery_meetings.show__modal_edit__event_id
$idaa_sess.recovery_meetings.show__modal_edit__event_id;
var is_safari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
if (is_safari) {
console.log('Safari detected, using forced scroll to top...');
// Safari does not support smooth scroll, so we use a regular scroll
document.getElementById('ae_idaa')?.scrollTo(0, 0);
// document.getElementById('ae_idaa')?.scrollTo({
// top: 0,
// behavior: 'smooth'
// });
}
}}
class="novi_btn btn btn-secondary btn-md preset-tonal-primary border border-primary-500 hover:preset-filled-primary-500 transition"
title={`Open to see details: ${idaa_event_obj?.name}`}