Search code examples
jqueryscrollkendo-uimodal-dialog

How to reset the scroll position in a Kendo Dialog (jquery)


I am wanting to re-open a previously opened kendo dialog. The dialog has scrolling content so when it re-opens I want to be at the top of the dialog again. How? Or will I need to destroy and re-create?


Solution

  • Use jQuery's .scrollTop() - https://api.jquery.com/scrollTop/

    Call .scrollTop(0) on the scrollable element when the dialog is opened. You could use either the open or show event of the dialog (probably open in this case).

    https://docs.telerik.com/kendo-ui/api/javascript/ui/dialog/events/open

    https://docs.telerik.com/kendo-ui/api/javascript/ui/dialog/events/show