Page is scollable behind lightbox when I want scrolling disabled.

As the title says I have a lightbox pop up. However the page content can still be scrolled through without closing the lightbox. Is there a way to disable page scrolling while a lightbox is open? thanks.


Drop this code into Custom code under Settings.


    scrollTop =
        window.pageYOffset ||
    scrollLeft =
        window.pageXOffset ||

        // if any scroll is attempted,
        // set this to the previous value
        window.onscroll = function () {
            window.scrollTo(scrollLeft, scrollTop);
            // console.log('scroll')

    function preventBehavior(e) {
        // console.log('touchmove')

    document.addEventListener("touchmove", preventBehavior, {passive: false});