disableScrolling function

void disableScrolling()

Disables scrolling in browser.

Implementation

void disableScrolling() {
  var scriptCode = '''

  if ( window.$_jsFunctionBlockScrolling == null ) {
    $_jsFunctionBlockScrolling = function(event) {
      window.scrollTo( 0, 0 );
      event.preventDefault();
    }
  }

  ''';

  addJavaScriptCode(scriptCode);

  evalJS('''
    window.addEventListener('scroll', $_jsFunctionBlockScrolling, { passive: false });
  ''');
}