we click on a button it opens a modal → a custom script is launch in order to disable the scroll when the modal is open (as mentioned into the forum)
the modal is open with a menu selection on the top, when we click into a choice (introduction, bedrooms, location) → a JS script is activated to scroll to the position of the according div using the following snippet :
function scrollToElement() {
let access = wwLib.getFrontDocument().getElementById("bedrooms_div");
if (access) {
let offsetPosition = access.getBoundingClientRect().top + wwLib.getFrontWindow().pageYOffset - 40;
wwLib.getFrontWindow().scrollTo({
top: offsetPosition,
behavior: "smooth"
});
}
}
// Call scrollToElement() directly without interval
scrollToElement();
nothing happen
on close we have the script at the level 2. which is reactivated in order to take back the scrolling control of the Parent page.
It should fix your issue!
Tell me if it works for you.
Keep in mind that you may need to remove this parentNode in the coming months when we remove all wrappers (we will send emails to warn you all). By the way, when we do this, you’ll all have 40% less elements in your DOM. So your app will be loaded faster!