Like when you press the button to scrolling pages?

Have the code open the modal window by clicking on the button. How to make so that when pressing, it was not possible to scroll outside the window?
$(".close-modal").on('click', function(e){
e.preventDefault();
e.stopImmediatePropagation;

 var $this = $(this),
 modal = $($this).data("modal");

$(modal).removeClass("open");
 setTimeout( function(){ 
$(modal).parents(".overlay").removeClass("open");
 }, 350);

});
April 7th 20 at 10:41
1 answer
April 7th 20 at 10:43
$('body').addClass('modal-open');

.modal-open {
 overflow: hidden;
}
why doesn't it?
I want to remove scrolling from the body, not only in the
$('body').addClass('body-freeze');

.body-freeze {
overflow: hidden;
} - Cale12 commented on April 7th 20 at 10:46

Find more questions by tags jQuery