Work on getting the scroll to work for Safari....
This commit is contained in:
@@ -218,7 +218,7 @@ if (browser && iframe == 'true') {
|
||||
}
|
||||
|
||||
$effect(() => {
|
||||
if ($ae_loc.iframe && $ae_loc.iframe_height && $ae_loc.iframe_height_modal_body) {
|
||||
if ($ae_loc.iframe && $ae_loc.iframe_height && $ae_loc.iframe_height_modal_body) {
|
||||
if (log_lvl > 1) {
|
||||
console.log('Getting new dimensions for iframe with modal:', $ae_loc.iframe_height, $ae_loc.iframe_height_modal_body);
|
||||
}
|
||||
@@ -244,12 +244,24 @@ $effect(() => {
|
||||
if (log_lvl > 1) {
|
||||
console.log(`Suggested new iframe_height with modal: ${iframe_height}`);
|
||||
}
|
||||
if (iframe_height > 4096) {
|
||||
console.warn('iframe_height is getting too large, setting to 4096px');
|
||||
iframe_height = 4096; // Limit the height to a maximum of 4096px
|
||||
}
|
||||
window.parent.postMessage({'iframe_height': iframe_height}, "*"); // This should be in pixels
|
||||
} else if ($ae_loc.iframe && $ae_loc.iframe_height) {
|
||||
if (log_lvl > 1) {
|
||||
console.log('Suggested new iframe_height:', $ae_loc.iframe_height);
|
||||
}
|
||||
window.parent.postMessage({'iframe_height': $ae_loc.iframe_height}, "*"); // This should be in pixels
|
||||
|
||||
let iframe_height = 0;
|
||||
iframe_height = $ae_loc.iframe_height;
|
||||
|
||||
if (iframe_height > 4096) {
|
||||
console.warn('iframe_height is getting too large, setting to 4096px');
|
||||
iframe_height = 4096; // Limit the height to a maximum of 4096px
|
||||
}
|
||||
window.parent.postMessage({'iframe_height': iframe_height}, "*"); // This should be in pixels
|
||||
}
|
||||
});
|
||||
|
||||
@@ -363,12 +375,16 @@ $effect(() => {
|
||||
if (is_safari) {
|
||||
console.log('Safari detected, not using smooth scroll to top');
|
||||
document.getElementById('ae_idaa')?.scrollTo(0, 0);
|
||||
|
||||
window.parent.postMessage({'scroll_to': 0}, "*"); // This should be in pixels
|
||||
} else {
|
||||
console.log('Not Safari, using smooth scroll to top');
|
||||
document.getElementById('ae_idaa')?.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
|
||||
window.parent.postMessage({'scroll_to': 0}, "*"); // This should be in pixels
|
||||
}
|
||||
}}
|
||||
title="Scroll to top"
|
||||
|
||||
Reference in New Issue
Block a user