New to Kendo UI for Angular? Start a free 30-day trial

Environment

ProductProgress® Kendo UI® for Angular Dialog

Description

How can I disable page scrolling when opening the Dialog?

Solution

You can add the .k-overflow-hidden built-in CSS class to the body element when opening the Dialog. Use addClass method of Angular Renderer2 class:

  constructor(public renderer: Renderer2){}

  public onOpen() {
    this.opened = true;
    this.renderer.addClass(document.body, 'k-overflow-hidden');
  }

Remove the class when closing the Dialog, using removeClass method:

  public onClose(status) {
    this.opened = false;
    this.renderer.removeClass(document.body, 'k-overflow-hidden');
  }

In this article

Not finding the help you need?