Bug fix for scroll to end.

This commit is contained in:
Scott Idem
2025-09-19 16:50:14 -04:00
parent 5b7aa320e2
commit 79c0c90eae
2 changed files with 35 additions and 23 deletions

View File

@@ -74,6 +74,7 @@ let yTop = $state(0);
let yScroll = $state(0);
let yHeight = $state(0);
let scroll_x = $state(0);
let scroll_y = $state(0);
function parse_scroll() {
@@ -225,16 +226,6 @@ function scroll_container() {
class:opacity-0={yTop < 750}
class:ae_btn_warning_filled={yTop > 1500}
onclick={() => {
log_lvl = 1;
if (log_lvl) {
console.log(`Scroll to top button clicked. scroll_y: ${scroll_y} scrollTop: ${scroll_container().scrollTop}`, scroll_container());
// document.getElementById('ae_idaa')?.scrollTo(0, 0);
// document.documentElement?.scrollTo(0, 0);
// document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
// document.body.scrollTop = 0; // For Safari
}
console.log('Not Safari, using smooth scroll to top');
document.getElementById('ae_main_content')?.scrollTo({
top: 0,
behavior: 'smooth'
@@ -264,27 +255,18 @@ function scroll_container() {
class:opacity-0={yTop < 750}
class:ae_btn_warning_filled={yTop > 1500}
onclick={() => {
log_lvl = 1;
if (log_lvl) {
console.log(`Scroll to bottom button clicked. scroll_y: ${scroll_y} scrollTop: ${scroll_container().scrollTop}`, scroll_container());
// document.getElementById('ae_idaa')?.scrollTo(0, 0);
// document.documentElement?.scrollTo(0, 0);
// document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
// document.body.scrollTop = 0; // For Safari
}
console.log('Not Safari, using smooth scroll to bottom');
document.getElementById('ae_main_content')?.scrollTo({
top: scroll_y,
top: yScroll,
behavior: 'smooth'
});
window.parent.postMessage({'scroll_to': scroll_y}, "*"); // This should be
window.parent.postMessage({'scroll_to': scroll_y}, "*");
}}
title="Scroll to bottom"
>
<span class="fas fa-arrow-down"></span>
Scroll to Bottom
<!-- yTop={yTop} yScroll={yScroll} yHeight={yHeight} scroll_y={scroll_y} scrollTop={scroll_container().scrollTop} total={scroll_container().scrollTop + yHeight} -->
</button>
</div>