Scroll to top

How to smoothlly scroll to top (anchor)?

$location.hash('anch');
$anchorScroll();

That’s not working.

Ionic already has a built-in scroll functionality.

Here’s a sample on how to use it : http://codepen.io/calendee/pen/jIJcm

Thanks it works.
Can I make nice animation??

Yep. See demo. Just changed to :

$scope.$broadcast('scroll.anchorScroll', true);

1 Like

You’re great! thanks

Unfortunately scroll functionality doesn’t work.
Could you fix it somehow?

I’ve noticed this too, and have had a hell of a time trying to implement scrolling. Commenting to see if anybody follows up.

I’m also curious of a solution that would help me to scroll contents of a div with overflow-y: scroll to top/bottom.

And for the the ionic scroller (ion-contnent, etc) these two calls make the job of scrolling:

  $scope.scrollBottom = function() {
    $ionicScrollDelegate.scrollBottom(true);
  };

  $scope.scrollTop = function() {
    $ionicScrollDelegate.scrollTop(true);
  };

Remember about injecting the $ionicScrollDelegate

If any has a solution for scrolling div to top/bottom without jquery, please post an idea :smile: .

2 Likes

I have a filter in a view that filters a ng-repeat. If the list is not on top filtered list is above panel. How do I know if the user start filtering the list.

here is a tutorial for a scroll to top button
http://pointdeveloper.com/how-to-add-scroll-to-top-button-for-ionic-phonegap-app/