Prevent touch scroll


#1

I am trying to prevent touchmove scrolling in codemirror altogether. I have used:

cm.getScrollerElement().addEventListener(‘touchmove’, function(e) { e.preventDefault();}, false);

However, under heavy JavaScript processing the scrollable area ‘breaks’ lose and responds temporarily.

Is there a CSS rule or a internal codemirror method to disable scrolling altogether? I am using cm.scrollTo(x,y) to set the viewable area.

thank you!
Chris


#2

I am not aware of a way to disable touch scrolling while still keeping the element scrollable, and CodeMirror relies on its element to be scrollable to work. You could make the editor’s height match its content, and wrap it in another, overflow: hidden element, I guess (but that will disable the partial rendering of big documents optimization).