New scroll to top button and functions.
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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}`}
|
||||
|
||||
Reference in New Issue
Block a user