The only issue here, which I can live with, is that when the modal opens the nav bar isnt displayed if I am scrolled down. It reappears when I close the modal. If anyone knows how to fix that, please let me know! Thanks.
Found a fix that keeps your sticky header and locks the background, without using Weweb’s dialog element.
On modal open, add the following custom JS action:
const doc = wwLib.getFrontDocument();
const scrollY = doc.defaultView.scrollY;
doc.body.style.position = “fixed”;
doc.body.style.top = -${scrollY}px
;
doc.body.style.width = “100%”;
// Store scroll position
doc.body.setAttribute(“data-scroll-y”, scrollY);
On modal close add the following action:
const doc = wwLib.getFrontDocument();
const scrollY = parseInt(doc.body.getAttribute(“data-scroll-y”) || “0”);
doc.body.style.position = “”;
doc.body.style.top = “”;
doc.body.style.width = “”;
doc.body.removeAttribute(“data-scroll-y”);
// Restore scroll position
doc.defaultView.scrollTo(0, scrollY);
Hope that helps!