Disable page scroll when button clicked

PHOTO EMBED

Mon Apr 11 2022 23:45:27 GMT+0000 (Coordinated Universal Time)

Saved by @max_demydenko #js #scroll

<script>
  $(".modal__open").click((e) => {
    e.preventDefault();
  	$('html')
    .css({
      'overflow-y': 'hidden'
    })
  })
  
  
  $(".modal__close").click((e) => {
    e.preventDefault();
  	$('html')
    .css({
      'overflow-y': 'scroll'
    })
  })
</script>
content_copyCOPY

This code adds event listeners to specific buttons (that open and close modal in this case) and disables/enables scroll for hole page when click is triggered