This is a migrated thread and some comments may be shown as answers.

Kendo UI Window, disable background scrolling

4 Answers 1457 Views
Window
This is a migrated thread and some comments may be shown as answers.
Kyle
Top achievements
Rank 1
Kyle asked on 14 Aug 2012, 06:18 PM
I have a model Kendo window that gets displayed on a large page. The window contains a scrollable grid. Whenever I hit the end of scrolling in the grid, the main webpage scrolls and the window stays where it is. Is there anyway that can be fixed?

4 Answers, 1 is accepted

Sort by
0
Accepted
Alex Gyoshev
Telerik team
answered on 15 Aug 2012, 12:54 PM
Hello Kyle,

You can remove the document scroll with the following line (when the window gets opened):
    $("html, body").css("overflow", "hidden");

When the window gets closed, restore the overflow styles with:
    $("html, body").css("overflow", "");

All the best,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Kyle
Top achievements
Rank 1
answered on 15 Aug 2012, 07:06 PM
 Thanks, I modified my window with the following:

$('#myWindow').kendoWindow({
  modal: true,
  open: function(e) { $("html, body").css("overflow", "hidden"); },
  close: function(e) { $("html, body").css("overflow", ""); }
};

And that seems to work great.
0
Dimo
Telerik team
answered on 17 Aug 2012, 08:48 AM
Hello Kyle,

Please keep in mind that there are browsers that reset an element's scroll position when the overflow style is changed. You may want to save and restore the document's scroll position in the open/close handlers (if necessary).

Greetings,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Kyle
Top achievements
Rank 1
answered on 17 Aug 2012, 11:37 AM
Thanks for the tip!
Tags
Window
Asked by
Kyle
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Kyle
Top achievements
Rank 1
Dimo
Telerik team
Share this question
or