KUIB 3.0 Navigating Between Views

Posted by chamberlen.betat@mckee.com on 23-Jul-2018 16:45

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? 

Posted by vpetrov on 26-Jul-2018 02:37

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

Posted by vpetrov on 24-Jul-2018 00:18

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

Posted by chamberlen.betat@mckee.com on 25-Jul-2018 14:56

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?

Posted by vpetrov on 26-Jul-2018 02:37

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/.../

This thread is closed