Create Lightbox that does not close

Hi! I want to make certain pages only clickable to paid members. Ideally, I would like there to be a somewhat see-through box that scrolls down the page with the user as they scroll, not letting them click the content until they click “Become a Member.” Please see screenshot.

I called Wix Support and unfortunately this does not seem possible. However, he suggested using a Lightbox as a work-around.

I know I can create a Lightbox and disable the close buttons, however, if you hit escape or even just click outside the box the lightbox disappears. I want the visitor to need to click Become a Member to get rid of it. (Also, I wish the lightbox would simply appear over the page so the users can still see the content, instead of by itself, but I understand if this is not possible.)

How can I accomplish this? I have seen a couple other posts related to this but there is not enough explanation for me to understand. I am a complete beginner when it comes to this.

Thank you! Austin :slight_smile:

Hello,

Found that it’s possible to disable the Escape key from closing the lightbox by using custom code.
You just need to place the following script in the Custom Code section under Settings → Custom Code in your Wix dashboard:

<script>
  document.addEventListener('keydown', function(event) {
    if (event.key === 'Escape') {
      event.preventDefault();
      event.stopPropagation();
      console.log('ESC key pressed – closing the age gate is disabled.');
    }
  }, true); // Capture phase to intercept early
</script>

This script prevents the default behavior of the Escape key and stops the event from propagating, helping to block the lightbox from closing.