I’m using Floating Groups as popups, instead of traditional popups, for various reasons (mainly being UX, I have greater control over positioning, animations and appearance).
Does anyone know how I can prevent users from being able to scroll screens underneath while the FloatingGroup is showing? Imagine it may need some CSS.
Now, that will set the Y overflow to hidden. You can read more about that here.
Adding the class
Utilizing Javascript, and the Toolbox plugin, we are going to go to where you trigger your popup to be “visible” and add a new workflow step. This will be called “Run javascript” - and in it, you will post this code:
// Get a reference to the <body> element
var body = document.body;
// Add the "no-scroll" class to the <body> element
body.classList.add("no-scroll");
and then, the opposite to re-enable scrolling:
// Get a reference to the <body> element
var body = document.body;
// Remove the "no-scroll" class from the <body> element
body.classList.remove("no-scroll");
Haven’t actually tested this at all, this is just off the top of my head, so hopefully it works. It makes sense, but I’m sure there is something I’m missing.