Need help stopping a JS script when lightbox opens

I have this piece of code stopping the scroll/stretch on mobile devices:

document.ontouchmove = function(event){
event.preventDefault();
}

What I need is some script that can disable the above js function when a lightbox is opened on the page.

See:

https://****-letters.flywheelsites.com/

for example the journal items open in a Lightbox, but the code stops them scrolling on mobile devices.