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){

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



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