To prevent the background of your website from scrolling while a modal is open, you need to add a small snippet of code at this time. Here's a quick guide on how to stop a page from scrolling when you have a modal open.
Let's beginClone this project ➞<script>
Webflow.push(function() {
$('.modal-button').click(function(e) {
e.preventDefault();
$('body').css('overflow', 'hidden');
}); $('.close').click(function(e) {
e.preventDefault();
$('body').css('overflow', 'auto');
});
});
</script>
<script>
Webflow.push(function() {
$('.modal-bg').click(function(e) {
e.preventDefault();
$('body').css('overflow', 'auto');
});
});
</script>