KUIB 3.0 Navigating Between Views - Forum - Kendo UI Builder - Progress Community

KUIB 3.0 Navigating Between Views

 Forum

KUIB 3.0 Navigating Between Views

This question is answered

When you navigate between two views, if you are scrolled down on a view and navigate to another view, the scrolling stays the same (if you are halfway down one view you will be halfway down the view you just navigated to). How can I scroll back to the top of a view when I navigate to it? I have tried putting this.$window.scrollTo(0,0); in the onShow of the my views but it doesn't work. Any suggestions? 

Verified Answer
  • The function that you have to use is actually scrollTop(0), not scrollTo(0,0), notice the 'p' at the end, sorry for misleading you.

    You can check this link for reference: api.jquery.com/.../

All Replies
  • Hi,

    Thank you for bringing our attention to this issue.

    My suggestion is to scroll the container that actually contains the scroll, not the window. This would be

    $('.main-content').scrollTo(0,0)

    in case of AngularJS or

    $('.kb-content').scrollTo(0,0)

    in case of Angular app.

    In the meantime I will log this in our system.

    Regards,

    Venelin

  • I am using an AngularJS app and tried putting 

    $('.main-content').scrollTo(0,0);

     in the onShow of my controller.public.js but I am getting an error: 

    angular.js:15018 TypeError: $(...).scrollTo is not a function
    at HomeTripInformationCtrl.onShow (controller.public.js:353)
    at eval (controller.js:145)
    at ChildScope.$emit (angular.js:19093)
    at updateView (angular-ui-router.js:4091)
    at eval (angular-ui-router.js:4005)
    at Scope.$broadcast (angular.js:19165)
    at eval (angular-ui-router.js:3369)
    at processQueue (angular.js:17396)
    at eval (angular.js:17444)
    at Scope.$digest (angular.js:18557)

    Any suggestions?

  • The function that you have to use is actually scrollTop(0), not scrollTo(0,0), notice the 'p' at the end, sorry for misleading you.

    You can check this link for reference: api.jquery.com/.../