Streaming live at 10am (PST)

Help adding second class to trigger function in custom code


#1

Hi,

I am using this custom code to stop scrolling behind a modal, it works fine but I want the user to be able to click on two elements to close the modal and return to the normal scrollable page, how do I add a second class ‘.X-icon-wrap’ to the second part of the code so that the user can click on both ‘.X-icon-wrap’ and ‘.close-link’ to perform the same function. I am sure this is simple but I don’t know what syntax to use to add the second class? Thanks.

<script>
Webflow.push(function() {
  $('.nav-link').click(function(e) {
    e.preventDefault();
	$('body').css('overflow', 'hidden');
  });

  $('.close-link').click(function(e) {
    e.preventDefault();
	$('body').css('overflow', 'auto');
  });
});
</script>