Work on getting the scroll to work for Safari....
This commit is contained in:
@@ -71,8 +71,8 @@ window.addEventListener('message', function(event) {
|
||||
|
||||
if (event.data) {
|
||||
if (event.data.iframe_height) {
|
||||
// console.log(`Got iframe height: ${event.data.iframe_height}`);
|
||||
idaa_ae_iframe_height = event.data.iframe_height;
|
||||
// console.log(`Got iframe height: ${idaa_ae_iframe_height}`);
|
||||
|
||||
let idaa_ae_iframe_element = document.getElementById('ae_idaa_recovery_meetings_iframe');
|
||||
|
||||
@@ -80,6 +80,39 @@ window.addEventListener('message', function(event) {
|
||||
idaa_ae_iframe_element.style.height = `${idaa_ae_iframe_height+50}px`;
|
||||
}
|
||||
|
||||
if (event.data.scroll_to !== undefined) {
|
||||
console.log(`Got scroll_to: ${event.data.scroll_to}`);
|
||||
|
||||
let idaa_ae_iframe_element = document.getElementById('ae_idaa_recovery_meetings_iframe');
|
||||
if (idaa_ae_iframe_element) {
|
||||
console.log(`Scrolling to: ${event.data.scroll_to}`);
|
||||
// window.scrollTo(0, 0); // This works for all current browsers
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
left: 0,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
// idaa_ae_iframe_element.scrollTo({x: 0, y: 0}); // Scroll to top
|
||||
// document.body.scrollTo({x: 0, y: 0}); // Scroll to top
|
||||
// document.body.scrollTo({
|
||||
// top: 0,
|
||||
// behavior: 'smooth'
|
||||
// });
|
||||
// document.body.scrollTop = 0;
|
||||
// idaa_ae_iframe_element?.scrollTo(0, 0)
|
||||
// idaa_ae_iframe_element.scrollTo({
|
||||
// top: 0,
|
||||
// behavior: 'smooth'
|
||||
// });
|
||||
// idaa_ae_iframe_element.scrollTo({
|
||||
// top: event.data.scroll_to,
|
||||
// behavior: 'smooth'
|
||||
// });
|
||||
} else {
|
||||
console.warn(`Element with ID "ae_idaa_recovery_meetings_iframe" not found.`);
|
||||
}
|
||||
}
|
||||
|
||||
const url = new URL(location);
|
||||
|
||||
// Check if event_id is defined in the message
|
||||
|
||||
Reference in New Issue
Block a user